#include #include using namespace std; int main() { ofstream output; ifstream test; // Test to see if the file already exists. test.open("results.txt"); // The file WAS found on the disk. // Exit the program, to prevent overwriting. if(test!=NULL) { cerr << "Output file already exits." << endl; cerr << "ABORTING!\a" << endl; exit(-2); } // Output file doesn't exist, // attempt to create it. output.open("results.txt"); // Did the output file get created successfully. if(output==NULL) { cerr << "Could not create output file" << endl; exit(-1); } output << "Good moring" << endl; output.close(); system("start results.txt"); return 0; }