Using the if condition I am trying to compare the buffer with the given jpg signatures, but I never find something. In GDB I just see the while looping, but never entering the if condition. What have I done wrong?
int block = 512;
int buffer[512];
int signature[3] = {0xff, 0xd8, 0xff};
int signature_1 = 0xe1;
int signature_2 = 0xe0;
while (!feof(inptr))
{
fread(&buffer, block, 1, inptr);
if (buffer[0] == signature[0] && buffer[1] == signature[1] && buffer[2] == signature[2] && (buffer[3] == signature_1 || buffer[3] == signature_2))
{
printf("found something \n");
}
}