代码
//还不支持中文文件名

#include
<iostream>
#include
<fstream>
#include
<strstream>
using namespace std;

int main(int argc,char *argv[])
{
if (argc!=3)
{
exit(
0);
}
ifstream source(argv[
1],ios::binary|ios::in|ios::ate);
ofstream dest(argv[
2],ios::binary|ios::out);
if (source.is_open())
{
ifstream::pos_type size
=source.tellg();
cout
<<size<<"bytes";
char * memblock = new char [size];
source.seekg(
0,ios::beg);//pointer return to the begin
source.read(memblock,size);
source.close();
//source is used up



dest.write(memblock,size);
dest.close();
}

return 0;
}
//http://www.cplusplus.com/doc/tutorial/files/