I'm using the fgetc() function for reading files.Aside from reading files I want it to read files such as EXEs as well.I test it by using a hex editor to insert 0200 0242 and then run the program.The problem is when I put it after a hex string like 0000 0000 0000 0000 the program will not read it instead it will terminate.Otherwise it will read it and report the match

Code:
int dvd_chk(FILE *x)
{
int num_chk=0;
char c;
while( (c = fgetc( x )) != EOF )
{
if ( c == 0x02 ) { c=fgetc(x);
if ( c == 0x00 ) { c=fgetc(x);
if ( c == 0x04 ) { c=fgetc(x);
if ( c == 0x24 ) { num_chk++; }
}}}
}
fclose( x );
return match;