#include <fstream>
#include<iostream>
#include <stdio.h>
using namespace std;
int main()
{
char buf[1024];
FILE* rfile;
FILE* wfile;
rfile = fopen("1.jpg","rb"); // 复制图像,也可以复制任意文件
wfile = fopen("2.jpg", "wb");
cout << "开始复制" << endl;
while (!feof(rfile))
{
memset(buf, 0, sizeof(buf));
size_t readlen = fread(buf, sizeof(char), sizeof(buf), rfile);
size_t writelen = fwrite(buf, sizeof(char), readlen, wfile);
}
fclose(rfile);
fclose(wfile);
cout << "done" << endl;
}