There are actually two parts to this problem.

I've only begun to learn file handling, so as much help as possible would be appreciated.

What I need the program to first do is read the file until it finds the string "XMAP" and record its offset. Then I need it to count each occurance of the string "CMAP" before and after the offset in two different values.

How to go about it?