stat用法
程序员文章站
2022-06-19 11:58:57
...
判断某个文件是否存在,可以用此接口.
bool file_exists(const char *path)
{
struct stat buffer;
int ret = stat(path, &buffer);
return (ret == 0);
}
系统调用删除某个文件
char runscript[128] = {};
sprintf(runscript, "%s%s", "rm -rf ", filename);
system(runscript);
system('sync')