-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathfile.c
More file actions
30 lines (28 loc) · 805 Bytes
/
file.c
File metadata and controls
30 lines (28 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
* copyright (c) 2024 Jack Lau
*
* This file is a tutorial about moving or deleting a file through ffmpeg API
*
* FFmpeg version 4.1.7
* Tested on Ubuntu 22.04, compiled with GCC 11.4.0
*/
#include <libavformat/avformat.h>
int main(int argc, char *argv[])
{
int ret;
//rename a file
ret = avpriv_io_move("111.txt","222.txt");
if(ret<0){
av_log(NULL, AV_LOG_ERROR, "Failed to rename the file \n");
return -1;
}
av_log(NULL, AV_LOG_INFO, "Success to rename\n");
//delete a file through url
ret = avpriv_io_delete("./mytestfile.txt");
if(ret<0){
av_log(NULL, AV_LOG_ERROR, "Failed to delete the file %s\n","mytestfile.txt");
return -1;
}
av_log(NULL, AV_LOG_INFO, "Success to delete mytestfile.txt\n");
return 0;
}