#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define MAXLEN 1
int main(int argc, char *argv[])
{
time_t timep;
int t1;
int t2;
t1 = time (&timep);
if( argc < 3 ){
printf("usage: %s %s\n", argv[0], "infile outfile");
exit(1);
}
FILE * outfile, *infile;
outfile = fopen(argv[2], "wb" );
infile = fopen(argv[1], "rb");
unsigned char buf1[MAXLEN];
unsigned char buf2[MAXLEN];
if( outfile == NULL || infile == NULL ){
printf("%s, %s",argv[1],"not exit\n");
exit(1);
}
int r1;
int r2;
while( (r1 = fread(buf1,1,MAXLEN,infile)) != 0 ){
r2 = fread(buf2,1,MAXLEN,infile);
fwrite( buf2, 1, r2, outfile );
fwrite( buf1, 1, r1, outfile );
}
fclose(infile);
fclose(outfile);
t2 = time (&timep);
printf("Time:%ds\n",t2-t1);
return 0;
}
SP5000系列烧录器大小端转换C语言实现
最新推荐文章于 2025-09-06 11:49:53 发布
