rshman.cpp
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C++ 代码 · 共 35 行
CPP
35 行
#include <iostream.h>
#include <fstream.h>
void main( void ) {
char ch;
fstream test ( "temp.txt", ios::in|ios::out );
test << "Just for fun!" << endl;
test.unsetf( ios::skipws ); // turn off the bit to skip white spaces
test.seekg( 0 );
cout << "The original content of \"temp.txt\":" << endl;
while( (test >> ch).good() ) {
cout << ch << flush;
}
cout << endl;
test.clear();
test.seekg( 0 );
cout << "The content of \"temp.txt\" without white spaces:" << endl;
while( (test >> ws >> ch).good() ) {
cout << ch << flush;
}
cout << endl;
// The other way to skip white spaces
test.clear();
test.seekg( 0 );
cout << "The content of \"temp.txt\" without white spaces:" << endl;
while( ( ( test.operator>>( ws ) ) >> ch).good() ) {
cout << ch << flush;
}
cout << endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?