Reputation: 387
I've used:
sprintf(hex, "%02x", (unsigned int) buffer[0] & 0xff);
to get hexadecimal representation of binary file. After that I save this representation to txt file.
Now I' d like to execute inverse operation. How can I create binary file from my hex data?
Upvotes: 1
Views: 491
Reputation: 22125
sscanf()
will let you do the inverse of sprintf()
int output;
int we_read_an_integer = sscanf(inputString, "%02x", &output);
Repeat as necessary.
Upvotes: 4