|
发表于 2022-6-13 10:12:12
|
显示全部楼层
太麻烦了,我写了一个C
#include <stdio.h>
#include <string.h>
int main( void )
{
unsigned char tmp;
unsigned long count = 0;
FILE *infp;
FILE *outfp;
infp = fopen( "T5L51.bin", "rb" );
outfp = fopen( "file.c", "wb" );
fprintf( outfp, "%s", "code char T5Lcode0[]={ \n" );
tmp = getc( infp );
while ( !feof( infp ) )
{
count++;
fprintf( outfp, "0x%02X,", tmp );
if ((count % 8) == 0 )
{
fprintf( outfp, "\n");
}
if((count % 1024) == 0)
{
fprintf( outfp, "%s", "};" );
fprintf( outfp, "code char T5Lcode%d[]={ \n",count/1024);
}
tmp = getc( infp );
}
fprintf( outfp, "%s", "};" );
fprintf( outfp, "\n\n//一共有%u个字节\n", count );
printf( "一共有%u个字节\n", count );
fclose( infp );
fclose( outfp );
return(0);
} |
|