I have a situation where I'm parsing an xml file in c++(using libxml) and with the extracted info I'm creating a data structure on the fly & modifying the D.S according to the further extracted info from the parsed file. Now I need to save the D.S as it is, in secondary memory and I want to retrieve back the D.S from开发者_JS百科 memory later so that I can continue working further without the need of creating the D.S once again. Can someone please help me out on how to do this?
I suggest using a library like Boost.Serialization for this.
I assume that 'secondary memory' is a hard drive or something. In that case use fwrite and fread, or in C++ overload << and >> if you want. How you do this depends on your data structure, if it has members that are pointers then things get a bit more complicated.
There's not enough info in your question to really help you.
精彩评论