?? convert.cpp
字號:
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *infile,*outfile;
//int ch[32],exch[32];
char filename[20]="D:/test/test3.eti";
unsigned char num1;
int j;
infile = fopen(filename,"rb");
outfile= fopen("D:/test1.coe","w");
if (infile==NULL)
{
printf("\n The file %s was not successfullly opened!",filename);
printf("\n Please check that the file currently exists.\n");
exit(1);
}
fprintf(outfile,"MEMORY_INITIALIZATION_RADIX=16;\n");
fprintf(outfile,"MEMORY_INITIALIZATION_VECTOR=\n");
for(j=1;j<=6144;j++)
{
fread(&num1,sizeof(num1),1,infile);
printf("%x\n",num1);
fprintf(outfile,"%0.2X",num1);
if(j%4==0)
fprintf(outfile,(j==6144) ?";\n": ",\n");
}
fclose(infile);
fclose(outfile);
return 0;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -