|
Boost : |
Subject: Re: [boost] boost::serialization, binary archive contents
From: Stefan Strasser (strasser_at_[hidden])
Date: 2009-12-23 11:22:53
Am Wednesday 23 December 2009 02:22:09 schrieb Dan:
> Hi All,
>
> Im not sure if this the correct mailing list or not.. in fact im not sure
> if i'm even going about this the right way.. forums are so much easier..
there is a boost-users mailing list on the same site you joined this one.
but I would like to see a message board on the boost website as well.
noone is used to mailing lists anymore.
>
> Im using the boost::serialization library, im attempting to serialize an
> image file from the freeimage library.
>
> It is working beautifully if i serialize to a text archive however, binary
> archives fail to load with a "stream error" exception.
is your stream a std::ios::binary stream?
see
http://www.boost.org/doc/libs/1_41_0/libs/serialization/doc/special.html#binary_archives
> boost::serialization::array<BYTE> ao =
> boost::serialization::make_array<BYTE>(pData, dwSize);
> ar & ao;
your code looks ok.
you can replace this part with
ar.load_binary(pData,dwSize).
(this has nothing to do with the exception you're getting though, it's just
easier to read.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk