Python Binary to C Header

Introduction Once again I needed to embed some text files into a C application. The right way to do this is turn the data into a byte array and compile it in. At least it’s the most portable way because some compilers have string length limitations. xxd -i is the easiest way to format the data so it can be compiled in. However, just like the last time, I don’t have access to xxd -i....

October 9, 2019 · John

Binary Headers

Introduction Earlier in the year I wrote a Lua implementation of xxd -i (it’s at the bottom under the “Embedding” section). I wrote this because a few platforms I was working with didn’t support xxd. I didn’t want to attempt compiling and installing it. I had Lua installed on these platforms so it was easier to write a Lua script to do the same thing. I only needed -i output so implementing all of xxd wasn’t necessary....

October 23, 2015 · John