Electrical and Computer Engineering
23 of 30
UAH
CPE 112
Case Study: Implementation
•void OpenForInput( /* inout */ ifstream& someFile )   
•                                     
•// Prompts the user for the name of an input file
•// and attempts to open the file
•// Postcondition:
•//     The user has been prompted for a file name
•//  && IF the file could not be opened
•//         An error message has been printed
•// Note:
•//     Upon return from this function, the caller must test
•//     the stream state to see if the file was successfully
•//     opened