how to check if file is opened c++ code example
Example: how to check if file is opened c++
ifstream file;
file.open(argv[1]);
if (!file.is_open()) {
cerr << "File did not open";
exit(1);
}
ifstream file;
file.open(argv[1]);
if (!file.is_open()) {
cerr << "File did not open";
exit(1);
}