#include <stdio.h>
#include <stdlib.h>
#define TRAN_SZIE 1024
int copy_bin(char* from, char* to)
{
FILE *fin, *fout;
int size;
char buf[TRAN_SZIE];
if ((fin=fopen(from,"rb"))==NULL) {
perror("fopen filein");
exit();
}
if ((fout=fopen(to,"wb"))==NULL) {
perror("fopen fileout");
exit();
} while(!feof(fin)) {
size = fread(buf, , TRAN_SZIE, fin);
fwrite(buf, , size, fout);
} fclose(fin);
fclose(fout);
return ;
} int main(int argc, char * argv[])
{
int ret = ;
if (argc!=) {
printf("Usage: %s filein fileout\n", argv[]);
exit();
} ret = copy_bin(argv[], argv[]); return ret;
} /*
[root@localhost]# ./copy_bin IMG1.jpg IMG2.jpg
[root@localhost]# diff IMG1.jpg IMG2.jpg
*/