Boost logo

Boost Users :

Subject: [Boost-users] [Serialization] Sometimes Fails Reading Binary File
From: Robert McCullough (rob_at_[hidden])
Date: 2010-06-15 12:06:09


Hi,

 

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?

 

 

Best regards,

Robert McCullough

 

Senior Software Engineer

Promess Incorporated

11429 Grand River Road

Brighton, Michigan 48116

Email: <mailto://rob@promessdev.com> mailto://rob@promessinc.com

Web: <http://promessinc.com/> http://promessinc.com

Tel: (810) 229-9334

Fax: (810) 229-8125

 

 



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