|
Boost : |
Subject: Re: [boost] boost::serialization, binary archive contents
From: Dan (dan.t_at_[hidden])
Date: 2009-12-28 23:35:44
Thanks for both of your replys. Please excuse my late reply, work has
finished for the year and the ISP at home is messing around (been without
internet for over a month!). Im posting this from a internet cafe so my i
may not be able to reply frequently.
Yes i did insure that std::ios::binary was specified for the archive.
I cant remeber if i posted this in my previous message (and am not sure
how to check) however, I did more testing and managed to get a simple
binary archive example to work for a particular image. Without changing
the code, apart from making it load a different image, caused it to then
throw the exception.
I will try to post an example that shows the issue at some point.
Other than the std::ios::binary is there any other differences required
between the text and binary archives?
> 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.)
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk