How to find bytes in binary file. I read the binary file to a string and try to do "strstr()" It doesn't work. if I print the string in loop as %c the string is dont look the same but if I print as %x or %02hhX it looks the same. I open two binary file and try to see if one file is hiding in the other file. to kind of anti virus code.
my code:
FILE* file = fopen(filePath, "rb");
FILE* signature = fopen(signaturePath, "rb");
fread(fileStr, fileSize, 1, file);
fread(signatureStr, signatureSize, 1, signature);
int in = strstr(fileStr, signatureStr);
if (in)
{
printf("bytes found.\n");
}
else
{
printf("sorry...\n");
}