c++ detect when file is opened 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);
}