FFmpeg 文件操作
环境: vs2017 + ffmpeg4.3
#include <iostream>
#ifdef __cplusplus
extern "C"
{
#include "libavutil/log.h"
#include "libavformat/avformat.h";
}
#endif // _cplusplus
void fileOperate()
{
//重命名文件
// test.txt: 源文件 mytest.txt: 目标文件
int ret = avpriv_io_move("test.txt", "mytest.txt");
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Rename failed!\n");
}
av_log(NULL, AV_LOG_INFO, "Rename sucess!\n");
// 删除文件
ret = avpriv_io_delete("./mytest.txt");
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Delete mytest.txt failed!\n");
}
av_log(NULL, AV_LOG_INFO, "Delete sucess!\n");
}
int main()
{
fileOperate();
return 0;
}