Electrical and Computer Engineering
10 of 19
UAH
CPE 112
Implementation
•void OpenForInput( /*inout*/ ifstream& someFile )  // File to be
•                                                     // opened
•// Prompts the user for the name of an input file
•// and attempts to open the file
•
•{
•    string fileName;    // User-specified file name
•
•    cout << "Input file name: ";
•    cin >> fileName;
•
•    someFile.open(fileName.c_str());
•    if ( !someFile )
•        cout << "** Can't open " << fileName << " **" << endl;
•}
•