#include <fstream>
ifstream fin(L"E:\\test.txt",ios::binary);
if(!fin)
{
return NULL;
}
//
fin.seekg(0,ios::end);
unsigned long ulLength=(unsigned long)fin.tellg();
fin.seekg(0,ios::beg);
//
char *buf=new char[ulLength];
fin.read(buf,ulLength);
fin.close();
ofstream fout(L"E:\\a.txt",ios::binary);
fout.write(char * tarBuf ,unsigned long tarLen);
fout.close();