Boost logo

Boost Users :

Subject: [Boost-users] [Serialization] Testing if a provided file is actually a serialized archive
From: Cedric Laczny (cedric.laczny_at_[hidden])
Date: 2011-02-25 07:22:21


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.

Best,

Cedric


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