0

I don't understand something. In recover, to store the card data, I've used a buffer which is an array of 512 BYTES(i.e. uint8_t). In (almost) every element of the array is stored an hexadecimal value. We in fact look for buffer[i], buffer[i+1], buffer[i+2] and buffer[i+3] that should be the beginning of a jpg (where i is an unknown number). All things work in my work. But: Why is a hexadecimal value stored in 1 byte? I thought that a hexadecimal is a number like an int, whose size is 4 bytes. In fact I've initially used an array of 128 int (512byte) for reading the card data, and my code wasn't working. There should be something I couldn't understand...An explanation? Thanks

1

Don't confuse hexadecimal with a type of number. It is simply a way to write the binary values in a different way.

Each byte in the JPG is 8 bits long. Those 8 bits can be represented in binary, in hexadecimal, in decimal, etc, although those will all essentially mean the same thing.

So the first byte of a JPG is the value 0xff (in hex), or 255 (in decimal) or 1111 1111 (in binary).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .