Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-09-17 16:09:42


Konstantin Andreev wrote:

Make the following change:

int main( void )
{
    Sample *obj_to = NULL;
    const Sample * const obj_fr = new Sample( 55, "**** test string
*****" );
    std::cout << *obj_fr;

    std::stringstream archbuf;
    boost::archive::text_oarchive *oa = new boost::archive::text_oarchive(
archbuf, 3 );

    *oa << obj_fr;
    std::cout << "-- archive content: >" << archbuf.str() << "<\n";
    archbuf.flush(); // make this change
    delete oa;

    boost::archive::text_iarchive *ia = new boost::archive::text_iarchive(
archbuf, 3 );
    *ia >> obj_to;
    std::cout << *obj_to;

                   ///////////////////////////////////
    *ia >> obj_to; // ARCHIVE IS OVER. BOOM !!!
                   ///////////////////////////////////

    std::cout << *obj_to;

    delete ia;
    return 0;
}


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