#include #include int main() { const int MAXLENGTH = 21; // maximum file name length char file1[MAXLENGTH]; ifstream inFile; cout << "Please enter the name of the file you wish to open: "; cin >> file1; 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; }