< previous page page_887 next page >

Page 887
    return 0;
}

//******************************************************************

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

// 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

{
    char fileName[51];   // User-specified file name (max. 50 chars)

    cout << Input file name: ;
    cin.get(fileName, 51);
    cin.ignore(100, \n);

    someFile.open(fileName);
    if ( !someFile )
        cout << ** Can't open  < fileName < ** < endl;
}

//******************************************************************

void GetCurrentDate( /* out */ DateType& currentDate )   // Today's
                                                         //   date
// Reads the current date from standard input

// Postcondition:
//     User has been prompted for the current month, day, and year
//  && currentDate is set according to the input values

{
    int month;
    int day;
    int year;

    cout << Enter current date as three integers, separated by

 
< previous page page_887 next page >