Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] Sometimes Fails Reading Binary File
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-06-17 11:01:50


AMDG

Robert McCullough wrote:
> Does the Serialization library support multi-thread application.
> My application uses boost::archive::binary_iarchive and
> boost::archive::binary_oarchive to serialize data to/from files in several
> different threads.
> I believe this might be happing at the same time.
> Could this be causing my problem?
>

It's quite possible. Do you know that fstream is thread safe?
Can you try just reading the first four bytes of the file and checking them?

std::size_t length;
ifs.read(&length, 4);
assert(length == 0x16);

In Christ,
Steven Watanabe


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