
Durrr! Thanks <again> Robert. You rock.
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Robert Ramey Sent: Friday, January 20, 2006 12:31 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] Serialization "stream error" whenusingbinary_iarchive/binary_oarchive & make_binary_object,but xml_iarchive & text_iarchive suceeds
Double check that the stream is opened with ios::binary. This is a common gotcha that shows up in this circumstance.
Robert Ramey
Terence Wilson wrote:
I've been scratching my head trying to figure this one out for a few days. My code serializes xml_iarchive & text_iarchive with no problems, however, when I substitute the binary_iarchive I get a "stream error" serialization exception thrown during the make_binary_object call when reading a binary file:
template<class Archive> void serialize(Archive & ar, const unsigned int) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(CImageDataBase2D);
if (Archive::is_loading::value) { Alloc(); }
//ar & boost::serialization::make_nvp("ImageData", boost::serialization::make_binary_object(m_pData, sizeof(T)*m_x*m_y));
const int blobSize=sizeof(T)*m_x*m_y; _ASSERTE(blobSize); ar & boost::serialization::make_nvp("ImageData", boost::serialization::make_binary_object(m_pData, blobSize)); }
I've tried to excise the relevant code to a console project, however, it has tentacles and will take a few more days. In the mean time I would appreciate help from anyone that might have a suggestion.
I've looked at the code and can find nothing wrong, as I said, ASCII and XML serialization works flawlessly
I'm using Visual Studio 8 with Boost 1.33.1.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users