blob: 351dd24e04dd22585294e44f04656a3b1daaba2b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <stdio.h>
int main( int argc, const char * argv [] )
{
const char * varname = argv[1];
int i = 0;
int c;
printf( "/* automatically generated by bin2hex */\n" );
printf( "static unsigned char %s [] =\n{\n", varname );
while ( ( c = getchar( ) ) != EOF )
{
if ( i != 0 && i % 10 == 0 )
printf( "\n" );
printf( "0x%02lx,", c & 0xFFl );
i++;
}
printf( "};\n#define %sLen %d\n", varname, i );
return 0;
}
|