0

I'm doing pset4 recover program. I've written following code to read 512 bytes of data at once and detect the start of any jpg image

BYTE buffer[512];

while((fread(buffer, 512 * sizeof(BYTE), 1, CFcard)) == 1)
{
    if ((buffer[0] == 0xff) && (buffer[1] == 0xd8) && (buffer[2] == 0xff) && ((buffer[3] == 0xe0) || (buffer[3] == 0xe1)))
    {
        printf(".jpg\n");

where BYTE is typedef of uint8_t. But after executing the program it prints only one ".jpg" in the terminal console window. So, I want to know whether my condition is correct to determine the start of jpg image.

Thank you.

2
  • please update your question with a full copy of your code!
    – kzidane
    Jun 18, 2015 at 10:07
  • O I got it, my program is producing correct result now and check50 also successfully showed green to all cases. Jun 18, 2015 at 10:50

0

You must log in to answer this question.

Browse other questions tagged .