This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/cplbexam/iostream/istream/seekgpos.cpp

19 lines
406 B
C++
Raw Normal View History

#include <iostream.h>
#include <fstream.h>
void main( void ) {
char s[20];
int pos = 4;
fstream test;
test.open( "temp.txt", ios::in|ios::out );
test << "Hello, my world." << endl;
test.seekg( pos );
cout << "The content of \"temp.txt\" starts at offset "
<< pos << ":" << endl;
while( (test >> s).good() ) {
cout << s << " " << flush;
}
}