Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-12-22 23:18:18


Merrill Cornish wrote:

<snip...>
> // save data to archive
> ofstream outStream(archiveFile);
> boost::archive::xml_oarchive outArchive(outStream);
>
> // write class instance to archive
> outArchive << testObj_out;

try this instead:

        outArchive << BOOST_SERIALIZATION_NVP(testObj_out);

> } // archive and stream closed when destructors are called
>
> Succ* testObj_in = new Succ();
> {
> // create and open an archive for input
> ifstream inStream(archiveFile);
> boost::archive::xml_iarchive inArchive(inStream);
>
> // read class state from archive
> inArchive >> testObj_in;

and here as well

        inArchive >> BOOST_SERIALIZATION_NVP(testObj_in);

> } // archive and stream closed when destructors are called
> return;
> }//run()
> }//MyNS
>

<snip...>

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