Error-checking a class read from a binary file
I'm writing a certain class (the specifics don't really pertain to my question) to a file like so
And I read it later like so
fwrite((void*)&Map[MapID], sizeof(cMap), 1, fp);
Although I doubt anything will ever go wrong, how would I go about checking to make sure that the right information is being read? That the binary I'm reading is being mapped to the right parts of the structure, etc.? This code works, but I'd like to be able to check for consistency in case someone messes with files or something.
fread((void*)&Map[MapID], sizeof(cMap), 1, fp);