I’m looking forward to make my data usable during every restart of my program. The I am curious which is the best way to store to file than read back to program. i have been reading some stuff over the internet and the big question is XML or binary format? I’m still learning c++ i do not master it. the program’s objects are of type string int int … Which way do you recomand me to use and why?
One more thing does anyone know a good tutorial for this to binary or to XML?
Sorry for missing code part but i wanted to know some opinions of more advanced programmers than me. 😛
In addition to Matthais comment:
I think the most obvious format is the correct on in your case, and that is just plain text.
Just serialize your data in plain text (often delimited by spaces). The benifit of PT is that it is human readable, human modifiable, easy to process using streams (>> tokenisation or boost tokeniser) and flexible and is much light weight than XML.
For example you might want to store
you you would just write:
or whatever have you. This is always convient, for example name could contain two words so:
And the tokeniser would split on spaces and try and parse smith as an int but that is an easy problem to fix using delimiters. Such as “”