I have a file I am compiling in C++ in which I wish to have a string whose value is the contents of a file at the time of compilation.
In other words, I\'d like to #
You can use xxd -i /tmp/your_file > /tmp/your_file_as_string.c
Which will define a string literal for you:
$ cat /tmp/your_file_as_string.c
unsigned char _tmp_inc[] = {
0x2e, 0x2f, 0x42, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x6e, 0x65, 0x78, 0x74,
0x4f, 0x6f, 0x6c, 0x73, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f,
...
0x74, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x65, 0x63,
0x0a
};
unsigned int _tmp_inc_len = 1513;
Now you can use that defined string.