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.

Code:
std::deque <char> buffer;

//read in the first 3 characters

//loop
while(!eof)
{
    buffer.push_back(next_char)
    if("XMAP" in buffer)
    {
        //do something
    }
    buffer.pop_front()
}

you would have to read the file line by line and check the line for both substrings.
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.