通过修改name1.txt文件为name2.log 来学习avpriv_io_move("name1.txt","name2.log")
;
代码部分
#include <libavformat/avformat.h>
#include <libavutil/log.h>
int main(int agrc,char* argv[]){
av_log_set_level(AV_LOG_DEBUG);
int ret = avpriv_io_move("name1.txt","name2.log");
if(ret<0){
av_log(NULL,AV_LOG_ERROR,"Failed to rename file name1.txt \n");
return -1;
}
av_log(NULL,AV_LOG_INFO,"Success to rename file name1.txt ---> name2.log\n");
return 0;
}
编译
gcc -g -o rename rename.c `pkg-config --cflags --libs libavutil libavformat`
运行
./rename
image.png
网友评论