判断文件是否存在

#include <fstream>
#include <iostream>
using namespace std;

int main()
{
ifstream fin("hello.txt");
if (!fin)
{
cout << "can not open this file" << endl;

}
else {

cout << "file exit" << endl;
}


return 0;
}

posted @ 2021-08-25 16:48  江南王小帅  阅读(40)  评论(0)    收藏  举报