Re: [Boost-users] binary serialization, what's missing

Jeff Wrote:
Are the underlying streams opened as binary?
Jeff
Yes, This is how I save, the the restore is analogous. Using boost 1.39 void save(bool binary) const { if (binary) { std::ofstream ofs( fileName_.c_str(), ios::binary ); boost::archive::binary_oarchive oa( ofs ); oa << *this; } else { std::ofstream ofs( fileName_.c_str() ); boost::archive::text_oarchive oa( ofs ); oa << *this; } } Ok I was trying eventually to use the portable binary archive, however I suspect that would crash as well. I will try to create a standalone program that shows the crash using the binary archive first. Best regards, Ta, Avi

Avi Bahra wrote:
Jeff Wrote:
Are the underlying streams opened as binary?
Jeff
Yes, This is how I save, the the restore is analogous. Using boost 1.39
void save(bool binary) const {
if (binary) { std::ofstream ofs( fileName_.c_str(), ios::binary ); boost::archive::binary_oarchive oa( ofs ); oa << *this; } else { std::ofstream ofs( fileName_.c_str() ); boost::archive::text_oarchive oa( ofs ); oa << *this; } }
Ok I was trying eventually to use the portable binary archive, however I suspect that would crash as well. I will try to create a standalone program that shows the crash using the binary archive first.
So are you saying you get a "Crash" when saving? Are you sure it "crashes" or are you failing to catch an exception being thrown by the serialization library? Can you stream out to an ostringstream? Jeff
participants (2)
-
Avi Bahra
-
Jeff Flinn