#include<iostream>
#include<cstdio>
#include <string.h>
#include <unistd.h>
using namespace std;
int main() {
int count = 1;
while (1) {
string filepath = "/home/cai/CLionProjects/socket_demo/file_test/remove_file" + to_string(count);
char filename_buf[filepath.size()];
strcpy(filename_buf, filepath.c_str());
if (access(filename_buf, 0) == -1) {
std::cout << "send_map_data-continue=no file" << std::endl;
break;
}
remove(filename_buf);
count++;
}
return 0;
}
c++ 删除文件
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。