如果我打开格式加上了app或ate,复制后内容的二进制文件被改了,碰到0x0A,会自动在前面加上0x0D.大家都是怎么处理的这问题?
ifstream in;
in.open(inpath,ios::binary);
ofstream out;
out.open(outpath,ios::binary||ios:app ate); // ||ios:app ate out 换行符会改变????但不写文件会被清除
in.seekg(0,ios::end);
long long size=in.tellg();
out.seekp(0,ios::end);
char * buf=(char * )malloc(size);//有隐含截断错误
in.seekg(0,ios::beg);
in.read(buf,size);
out.seekp(1,ios::end);
out.write(buf,size);