mardi 3 mai 2016

How to convert xxd generated hex back into identical file with C++?

Been using the xxd tool to generate a header file, from a file to be included in the code.

But my question is, how could i write out the generated hex to recreate the file that xxd was used on, making it identical to the original file?

example xxd output could be:

unsigned char gamedir_logs_game_log[] =
{
0x53, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x47, 0x61, 0x6d,
0x65, 0x2e, 0x2e, 0x2e, 0x0a, 0x0a, 0x0a, 0x30, 0x20, 0x77, 0x61, 0x72,
0x6e, 0x69, 0x6e, 0x67, 0x73, 0x0a, 0x30, 0x20, 0x65, 0x72, 0x72, 0x6f,
0x72, 0x73, 0x0a
,0x00
};
unsigned int gamedir_logs_game_log_len = 39;

Aucun commentaire:

Enregistrer un commentaire