Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] stream error when reading simple treestructure from a binary archive
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-03-13 11:55:18


CurieCat wrote:
> const Node* rootnode = root ;
> Node* newroot = NULL;
> std::ofstream ofs("filename", std::ios::binary);
> {
> boost::archive::binary_oarchive oa(ofs);
> oa << rootnode;
> }
> ofs.close();
> std::ifstream ifs("filename", std::ios::binary);
> {
> boost::archive::binary_iarchive ia(ifs);
> ia >> newroot;
> }
> ifs.close();
> return 0;
> }

try adding std::ios::binary in the right place.

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net