Boost logo

Boost Users :

From: Nat Goodspeed (ngoodspeed_at_[hidden])
Date: 2007-02-03 14:39:24


> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Adrian Grigore
> Sent: Saturday, February 03, 2007 9:11 AM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] boost::serialization throws random
exceptions
>
> Robert Ramey wrote the following on 2/3/2007 1:30 AM:
> > a) catch the archive exceptions and display an error message which
> > describes what kind of exception has been thrown.
>
> I did something similar, but it is still a poor workaround. I save
data
> incrementally and rotate savefile names to make sure the player does
not
> lose all data, but just the changes since the last increment. Still,
> losing all game progress since the last savefile increment is a major
> turnoff for most players.

[Nat] I think he was suggesting that you do that as a diagnostic measure
to help discover and solve the problem you're encountering. I don't
think he meant for you merely to put in the catch code and release the
program.
 
> > c) Just a while guess - thrown from load binary might suggest
> > either the file isn't being opened binary, or the size of data
> > being read isn't the same as what's being saved.
>
> I doubt that since there is only one save and one load routine in my
> application. If I opened the file as text when saving and as binary
when
> loading this would always fail. But in my case everything is working
> fine most of the time.

[Nat] But you COULD be having troubles even if you open the file as text
both for save and for load. In fact, the magic value 26 is a strong hint
that this may be the trouble. A byte containing binary 26 may, in text
mode, be interpreted as the character ctrl-Z -- which was the
traditional MS-DOS EOF marker.

Please try Robert's suggestion: ensure that you're opening the file
using the binary flag both for saving and for loading the file.


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