#include #include int main() { const int MAXLENGTH = 21; // maximum file name length char file1[MAXLENGTH] = "prices.dat"; // place the file name up front ifstream inFile; inFile.open(file1, ios::nocreate); // open the file if (inFile.fail()) // check for successful open { cout << "\nThe file named " << file1 << " was not successfully opened" << "\n Please check that the file currently exists." << endl; exit(1); } cout << "\nThe file has been successfully opened for reading.\n"; return 0; }