Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] Testing if a provided file isactually a serialized archive
From: Robert Ramey (ramey_at_[hidden])
Date: 2011-02-26 01:01:11


Cedric Laczny wrote:
> Hi,
>
> I would like to know if there exists a way to check for a given file
> if it is actually a serialized archive or a pure txt-file, at best
> without the need to read in that file completely.
> At the moment, I use boost::serialization to store self-defined
> class-instances in txt-files, so using something like the system's
> "file"-command would not bring me far.
> Now I would like my program to distinguish if the provided
> input-argument is a text-file that needs to be parsed or if it can
> simply restore this previous instance. Of course, using a separate
> option indicating if an archive was passed would work, but IMHO is
> not very beautiful.
>

serialization archives can be identified by special common text in the first
line.

Robert Ramey


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