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/ios/rdbuf.cpp

20 lines
447 B
C++

#include <iostream.h>
#include <fstream.h>
void main( void ) {
char ch;
fstream test ( "temp.txt", ios::in|ios::out );
cout << "Write a sentence:" << endl;
cin.get( *test.rdbuf() );
cout << "Your sentence has been saved in \"temp.txt\"." << endl;
test.seekg( 0 );
test.unsetf( ios::skipws );
cout << "The content of \"temp.txt\":" << endl;
while( (test >> ch).good() ) {
cout << ch;
}
}