c++判断文件是否存在
作者:
送分童子笑嘻嘻 | 来源:发表于
2020-05-04 14:36 被阅读0次#include <string>
#include <unistd.h>
#include <string.h>
#include <iostream>
#include <vector>
using namespace std;
int main(){
string filename_1 = "/home/cai/CLionProjects/socket_demo/file_test/get_file_create_time.cpp";
string filename_3 = filename_1.append("");
char filename_4[filename_3.size()];
strcpy(filename_4 , filename_3.c_str());
if (access(filename_4, 0) == -1) {
std::cout<<"dddddd" <<std::endl;
} else{
std::cout<<"DDDDDD" <<std::endl;
}
}
本文标题:c++判断文件是否存在
本文链接:https://www.haomeiwen.com/subject/qdtyghtx.html
网友评论