How to Embed an Arbitrary File in a C Program
A problem I've run into several times over the year, is that a small program I've written relies on another outside file. Maybe it needs to include an image, or maybe it relies on another small executable. It's a pain to deploy multiple files in these cases. I'd like everything nicely wrapped up into one executable.
So how do you embed a file into an executable?
Many years ago I wrote a small utility that takes a binary file for input. It then hex-encodes the file and outputs C code. The C code is an array which is initialized with the file's contents.
I just dug this program up to use it yet again, and I've decided that it'd be nice to share it.
Read the rest of How to Embed an Arbitrary File in a C Program

