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.