copy文件问题
自己写了一个copy文件函数,在copy exe时,(对于同一个文件的拷贝)有时可以完成copy,有时却会相差一点(即无法执行复制后的文件),望达人赐教!~
// 拷贝二进制文件
void copyfile ( char const* sourcefile, char const* destinationfile )
{
ifstream ifile( sourcefile, ios::binary );
if ( !ifile.is_open() )
return;
string str,temstr;
while ( getline ( ifile, temstr ) )
str += (temstr+'\n');
ofstream ofile( destinationfile, ios::binary );
ofile << str;
}