Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] Sometimes Fails Reading BinaryFile
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-06-16 02:21:51


try using an xml_archive instead. This has extra consistency checking and
is helpful for spotting errors.

Robert Ramey

Robert McCullough wrote:
>> Hi Steven,
>>
>> Answers to your questions:
>> a) it yields different behavior for the same archive.
>> b) See attached source LegacyMonitorPersistentData.h
>> c) See attached source PersistentData.h
>> d) I have not tried that. I will give this a try.
>> This is what I am testing.
>> I have this archive file ^Press.dat. that was created once by our
>> customer. I try to de-serializing using the loadPersistentData()
>> function and it works sometimes, but about
>> every third try it throw one of the exceptions.
>>
>> Thanks,
>> Robert
>>
>> > -----Original Message-----
>> > From: boost-users-bounces_at_[hidden] [mailto:boost-users-
>> > bounces_at_[hidden]] On Behalf Of Steven Watanabe
>> > Sent: Tuesday, June 15, 2010 3:44 PM
>> > To: boost-users_at_[hidden]
>> > Subject: Re: [Boost-users] [Serialization] Sometimes Fails Reading
>> Binary
>> > File
>> >
>> > AMDG
>> >
>> > Robert McCullough wrote:
>> > > I am using Boost 1.43.0, Linux 2.6.23, gcc version 4.0.0 on a
>> > > Freescale PowerPC.
>> > >
>> > > I am reading in a serialized binary file using
>> > >
>> > > Ifstream ifs;
>> > > try
>> > > {
>> > > Ifs.open(filename.c_str(), iso_base::binary | iso_base::in);
>> > > If(fs.is_open())
>> > > {
>> > > Boost::archive::binary_iarchive ia(ifs);
>> > > ia >> data;
>> > > ifs.close();
>> > > }
>> > > } catch (std:exception &e) {
>> > > Ifs.close();
>> > > }
>> > >
>> > > Sometimes it reads the file fine and sometimes it throws one of
>> the > > following errors.
>> > >
>> > > invalid_signature, Basic_string::resize, or stream error.
>> > >
>> > > Does anyone have an idea why sometimes it works and sometimes it
>> > does
>> > > not work?
>> > >
>> >
>> > a) Is the behavior consistent? i.e. does it yield different
>> behavior for
>> > different archives, or can it yield different behavior for the
>> same archive?
>> > b) What is data?
>> > c) How is the archive created
>> > d) Does it help if the archive is destroyed before the stream is
>> closed? >
>> > In Christ,
>> > Steven Watanabe
>> >
>> > _______________________________________________
>> > Boost-users mailing list
>> > Boost-users_at_[hidden]
>> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>
>
>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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