Well, you could keep the string in a FIFO queue... the queue is 4 chars long, search the queue for "XMAP", remove the first character from the queue and add the next character from the file to the back. You can use std::deque for a ready-made implementation.
std::deque <char> buffer;
//read in the first 3 characters
if("XMAP" in buffer)
If the file has VERY LONG LINES you'd be in for some trouble with this one. Eg. trying to read a UNIX-generated file using Windows EOL conversions.
you would have to read the file line by line and check the line for both substrings.