Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-01-23 15:30:01

Bo Peng wrote:
>I do not know how to write some type information at the
> beginning of the files and use a general iarchive to read it first.

the serialization library itself writes header information (unless opened
with "no_header")
itself. It also checks for the existence of this information (unless opened
with "no_header")
so you don't have to do anything otehr than catch the exception.

> This is what I am doing: try to guess the file type by file extension.
> If fails, use try/catch to read the file using different iarchive
> objects. I think it would be better to judge the file type by file
> header.

If you want to do that you'll have to look into the library code
to see how the headers are made and checked. But copying
this code into your app would be exactly equivalent to creating
the archive and catching the exception if it fails

Robert Ramey

> Bo

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at