I'm getting an odd crash whenever I close my program that seems to be caused by a string not de-allocating itself properly.
A bit of research indicates it may be related to some ambiguity between char and string types when reading from a binary file. (Something about char[] vs string()?) I have no idea what needs to be done to fix it, though.
"Name" is the only string in GameSaveData's class.
If the file it's attempting to load doesn't exist, and therefore "Name" is never written to, the error doesn't occur, which led me to believe it was a problem with the fstream code. I guess not.
You must realize that I cannot help you because you did not show any code.
But it could very much be possible that the code that you have shown first is the problem because to me it seems like a mess.
You should also note that invalid accesses do not always cause exceptions, it is just meerly undefined behavior. So are you using the same flags in the small demo as your full project?
Try to use a different method of serialization, for example just a dumb and simple stream into the file.
When writing a string you will need to write both the size of the string and the string.c_str().
When reading you will need to first read the size (written above) then resize the string to the required size before trying to read() the string. If you try to read() into an empty string your program will usually crash.
You haven't actually checked if your input is correct. I tested it and printed the output and it returned nothing (failed).
The main problem with the code (as jlb has stated) is your belief that string is like a cstring, and sizeof of a string is like a class with a vector inside of it (AKA a vector is just a pointer like a array allocated with new).