ifstream ifile("/home/zuma/xps.mp3", ios::binary | ios::in);
ofstream ofile("/home/zuma/xxx.mp3", ios::binary | ios::out);
copy(istream_iterator<unsigned char>(ifile), istream_iterator<unsigned char>(), ostream_iterator<unsigned char>(ofile));
ifile.close();
ofile.close();
Run Code Online (Sandbox Code Playgroud)
创建的新文件比原始文件的字节数少,文件不匹配