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

1.1     ! root        1: // exios121.cpp
        !             2: // The tellg 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:        while ( tfile.good() ) {
        !            12:           streampos here = tfile.tellg();
        !            13:           tfile.get( ch );
        !            14:           if ( ch == ' ' )
        !            15:              cout << "\nPosition " << here << " is a space";
        !            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.