#include <stdio.h>
#include <string.h>
#include <conio.h>
FILE *fi,*fo;
int i;
int main(int argc,char **argv) {
if (argc<3) {
printf("Usage:%s src des\n",argv[0]);
return 1;
}
if (0==stricmp(argv[1],argv[2])) {
printf("Src and des is same!\n");
return 2;
}
fo=fopen(argv[2],"wb");
if (NULL==fo) {
printf("Can not create file %s\n",argv[2]);
return 3;
}
fi=fopen(argv[1],"rb");
if (NULL==fi) {
fclose(fo);
printf("Can not find file %s\n",argv[1]);
return 4;
}
i=0;
fseek(fi,-1L,SEEK_END);
while (1) {
fputc(fgetc(fi)^0x5A,fo);
i++;
if (i%1000000==0) cprintf("\r%dKB",i/1000);
if (fseek(fi,-2,SEEK_CUR)) break;
}
fclose(fi);
fclose(fo);
cprintf("\r%dKB OK.\r\n",i/1000);
return 0;
}