参考了Dwing大侠 int _tmain(int argc, _TCHAR* argv[]) { unsigned char c; unsigned int n=0; FILE *fin =fopen("E://cnhacker.mid","rb"); FILE *fout=fopen("E://cnhacker.h" ,"wb"); if(!fin||!fout) {printf("not found data.bin!/n");return 0;} fprintf(fout,"unsigned char data[]={/r/n"); while(1) { c=fgetc(fin); if(feof(fin)) break; fprintf(fout,"0x%02X,",c); if(++n%16==0) fprintf(fout,"/r/n"); } fseek(fout,-1,SEEK_CUR); fprintf(fout,"/r/n};/r/n"); fclose(fout); fclose(fin); return 0; }