I had a photo named photo.jpg.
I used xxd -i
to generate a C++ file for my image file.
And the output is something like this:
unsigned char photo_jpg[] = {
0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01,
0x01, 0x01, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x84,...};
unsigned int photo_jpg_len = 24821;
I embedded that file into my main.cpp file and built it to generate my executable.
How could I possibly read that part of the hex dump which is my image file from the executable?
What have I tried...?
I used xxd myfile.exe > file.txt.
When I examine the hex dump of my executable generated with xxd, I see that the bytes of my photo_jpg character array are somewhere in the executable. You can see that in the image below: It is a screenshot of my executable hex dump.
How could I read that and store it inside of a character array like it was before being embedded into my executable?