6.3w+
社区成员
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc,char** argv)
{
fstream fsIn;
fstream fsOut;
char s[10]={0};
fsIn.open("cc.cpp",ios::in | ios::binary );
fsIn.read(s,10);
fsIn.close();
fsOut.open("1.txt", ios::out | ios::binary );
fsOut.write(s,10);
fsOut.close();
return 0;
}
void SaveToFile(char* buffer, int len)
{
ofstream ofs("byte.bin", ios::binary);
copy(buffer, buffer + len, ostream_iterator<char>(ofs));
ofs.close();
}