void abort();
#include <iostream>
#include <fstream>
#include <cstdlib>
int main() {
using namespace std;
ofstream qOutFile("OutFile.txt");
// Deliberately close the file just to test the error condition
qOutFile.close();
if (!qOutFile.is_open()) {
cerr << "File \"OutFile.txt\" could not be opened." << endl;
abort();
}
return 0;
}
© 20072024 XoaX.net LLC. All rights reserved.