Create a gist now

Instantly share code, notes, and snippets.

Create array from binary file
import sys
import textwrap
s=open(sys.argv[1], 'rb').read().encode("hex").upper()
t=",".join(["0x"+x+y for (x,y) in zip(s[0::2], s[1::2])])
print "const unsigned char data[] = {\n\t%s\n};"%" \n\t".join(textwrap.wrap(t,80))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment