Answer the question
In order to leave comments, you need to log in
Will this be serialization?
An object of a certain class is converted to a pointer to char into bits, and written through the stream to a file. Isn't this the notorious serialization?
If so, here's an example code:
ofstream out("lol.bin", ios::binary);
Lol lol;
lol.a = 129039;
lol.b = 2012093319;
out.write((char*)&lol, sizeof(Lol));
Answer the question
In order to leave comments, you need to log in
This will only work if all fields of the class are stored inside it, roughly speaking, if the class does not store any pointers or their surrogates (iterators).
If the field of your class is a pointer (or a surrogate), you will have to recursively serialize it already, which will result in a huge increase in complexity.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question