I am writing a program that creates an image file. I want the “original” image to be hard-coded in the program’s binary.
I was thinking…
char image[] = {
#include"image.jpg"
}
But I need to somehow convert the image into a format that can be #included into a c file as a char array?
Ok, use the unix tool xxd to create a c char array import of a given binary file, Like so:
This should produce output like:
See also: "#include" a text file in a C program as a char[]