Even a POD struct can be a problem, if it contains pointers.
To get away with saving and then reloading a struct by treating it as a byte array, all the data must be stored contiguously within the struct. So (e.g.) char arrays are in and char*s very much out.
Err, so what is the best way to handle mixed strings and binary data?
I think the most reasonable thing would be to write it all as text.
The only problem I have with that is if I add or remove data fields I have to manually update my read and write functions, wheras if I was writing and reading binary I just set the pointer and read/write to the end of the binary portion. It seems do-able to have text say at the beginning or end of the file and then start or end binary at a certain point.
Would it be better to split the file into two? One for text one for binary?