Here’s a useful little tool that I whipped up for another project. It takes a binary file and products C code containing the file in an array. Yes, there are other tools for this, but each has some problem or another (such as not making the array const, which is bad for memory usage; or not NUL-terminating the array for when you’re referencing a text file and want to use standard C string utilities for searching it).
The tool is a grand total of 54 lines includes blanks and white-space. Perfect size to just drop into your project’s source tree. No reason for a package or anything like that.
Using it is simple. Call the utility with the input filename and the name of the array to generate. The array will be defined as a const char. It’ll also define name_len as a const size_t with the length of the input file. The array is NUL-terminated (the NUL is not part of the _len constant). Output is send to stdout, so pipe/redirect it as needed. Useful if you want to put a bunch of such arrays into a single file.
Another version I may end up making for a similar purpose is one that just generates C string constants, one for each line, use the C constant string concatenation feature for making the input. For text files it’s (sometimes) nice to be able to see the text in your generated code, e.g. for debugging purposes.