Annotation of mstools/samples/iostutor/exios120.cpp, revision 1.1

1.1     ! root        1: // exios120.cpp
        !             2: // The seekg member function
        !             3: #include <fstream.h>
        !             4: 
        !             5: void main()
        !             6: {
        !             7:    char ch;
        !             8: 
        !             9:    ifstream tfile( "payroll", ios::binary | ios::nocreate );
        !            10:    if( tfile ) {
        !            11:       tfile.seekg( 8 );      // Seek eight bytes in (past salary)
        !            12:       while ( tfile.good() ) { // EOF or failure stops the reading
        !            13:          tfile.get( ch );
        !            14:          if( !ch ) break; // quit on null
        !            15:          cout << ch;
        !            16:       }
        !            17:    }
        !            18:    else {
        !            19:       cout << "ERROR: Cannot open file 'payroll'." << endl;
        !            20:    }
        !            21: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.