6 print('Usage: {0} <filename> <variable> <output>')
8 with
open(sys
.argv
[1], 'rb') as f
:
9 in_data
= f
.read().decode('utf-8', 'backslashreplace')
10 b
= [r
'\x{:02x}'.format(ord(c
)) for c
in in_data
]
12 out_data
= "const char {0}[] = \"".format(sys
.argv
[2])
13 out_data
+= "".join(b
) + "\";"
15 with
open(sys
.argv
[3], 'w') as f
: