I am not quite sure what you are trying to accomplish but but Linux command line utility xxd may be what you are looking for:
xxd -i [filename]
will generate a C style header file containing an array with your file contents in full binary encoding and a variable with its length.
Example:
xxd -i /proc/cpuinfo
makes a file with
unsigned char _proc_cpuinfo[] = {
0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x09, 0x3a, 0x20,
0x30, 0x0a, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x69, 0x64, 0x09,
...
};
unsigned int _proc_cpuinfo_len = 654390;
You can include the resulting header in your code and access the array and file length via those variables.