Jens Saathoff wrote:
Hi!
I'm using boost::serialization to save a structure to a file and read from a file. My code works perfect in debug-build, but in release-build an exception is thrown. I'm using MSVC2010 to build the project on Windows 7 64-Bit-Machine. The code is the same. Who could help me out?
You can find the code here: http://boost.codepad.org/8fp6XnC3
Hmmm - closing the datafile while the archive class is still open? Bad idea. when an XML archive closes, it has to add some end tags - but in your case you're closing the archive AFTER the stream has already been closed! Try std::wofstream datafile(wxString::Format(_T("%shuddata.prd"), paths.GetUserLocalDataDir()).ToStdWstring().c_str()); #ifdef DATA_TO_XML { boost::archive::xml_woarchive dataarchive(datafile); dataarchive << BOOST_SERIALIZATION_NVP(huddata); } #else { boost::archive::text_woarchive dataarchive(datafile); dataarchive << BOOST_SERIALIZATION_NVP(huddata); } datafile.close(); #endif
Thank you very much!!!!
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users