Let's go back to what you wrote in post #1:
Quote Originally Posted by ArakelTheDragon
Example:
search for String: 0x22 0x023 0x24
if String is found on line 9
print the whole line 9, or print until you find a custom terminating character like "0x9999 "

result must be: print 0x22 0x23 0x24 0x25 0x26 0x27 0x28.
From the phrase 'custom terminating character like "0x9999 "', we can infer that "0x22 0x023 0x24" isn't a null-terminated string of length 15; rather it is a sequence of three bytes such that sequences of this kind could possibly contain embedded null characters, and be terminated by some "custom terminating character". This is very important because when we say "string" in C, by default we are talking about a null terminated string, i.e., contiguous sequences of characters up to the first null character.

Consequently, your whole approach must change. You're dealing with a "binary file", not a text file, and with arbitrary sequences of bytes, not with strings. So strictly speaking, your file open mode should contain a 'b' (even though it may not be required), and you should be using file I/O functions that operate on bytes, not on strings (hence no fgets or puts), and you certainly cannot use strstr or strcmp because they assume null terminated strings as input.

Or, perhaps your example is technically wrong, e.g., it should not have been:
search for String: 0x22 0x023 0x24
but rather:
search for String: ""#;"
and the "custom terminating character" terminates the sequence to find, not the string. If so, then my analysis does not apply, and indeed you can use functions that operate on strings.