My problem goes like this: I have a class called \'Register\'. It has a string attribute called \'trainName\' and its setter:
class Register {
private:
str
You cannot write string this way, as it almost certainly contains pointers to some structs and other binary stuff that cannot be serialized at all. You need to write your own serializing function, and write the string length + bytes (for example) or use complete library, for example, protobuf, which can solve serializing problem for you.
edit: see praetorian's answer. much better than mine (even with lower score at time of this edit).