1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <fstream>
using namespace std;
int main() {
fstream FileName;
FileName.open("FileName.txt", ios::in);
if (!FileName) {
cout<<"File doesn’t exist";
}
else {
cout<<"File opened successfully";
}
}
FileName.close();
return 0;
}