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/fstream/ofstream/open.cpp

17 lines
330 B
C++
Raw Normal View History

#include <fstream.h>
void main( void ) {
char s[20];
ofstream output;
output.open( "temp.txt" );
output << "Hello, my world." << endl;
ifstream input ( "temp.txt" );
cout << "The content of \"temp.txt\" :" << endl;
while( (input >> s).good() ) {
cout << s << " " << flush;
}
}