借个地方 放下代码
程序代码:
#include "stdio.h" void main(int argc,char *argv[]) { FILE *fp,*fp1; unsigned char c,n1,n2; int i=1,count=0; if(argc<=2){ printf("参数过少"); exit(0); } if((fp=fopen(argv[1],"rb"))==NULL) printf("erroe"); if((fp1=fopen(argv[2],"wb+"))==NULL) printf("erroa"); fread(&c,sizeof(char),1,fp); fprintf(fp1,"\r\n%d\r\n\r\n",count++); n1=c&0X0f; n2=c&0Xf0; n2=n2>>4; while(!feof(fp)){ while(i<=512){ fprintf(fp1,"%X%X ",n2,n1); fread(&c,sizeof(char),1,fp); n1=c&0X0f; n2=c&0Xf0; n2=n2>>4; i++; } fprintf(fp1,"\r\n\r\n %d \r\n\r\n",count++); i=0; } fclose(fp1); fclose(fp); }