c++ 删除文件

#include
#include
#include 
#include 
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++ 删除文件)