fig18_03.cpp
来自「经典vc教程的例子程序」· C++ 代码 · 共 26 行
CPP
26 行
// Fig. 18.3: fig18_03.cpp
// Using command-line arguments
#include <iostream.h>
#include <fstream.h>
int main( int argc, char *argv[] )
{
if ( argc != 3 )
cout << "Usage: copy infile outfile" << endl;
else {
ifstream inFile( argv[ 1 ], ios::in );
if ( !inFile )
cout << argv[ 1 ] << " could not be opened" << endl;
ofstream outFile( argv[ 2 ], ios::out );
if ( !outFile )
cout << argv[ 2 ] << " could not be opened" << endl;
while ( !inFile.eof() )
outFile.put( static_cast< char >( inFile.get() ) );
}
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?