23 Jan
2006
23 Jan
'06
8:04 p.m.
I think the most practical way would be to try to create and archive with the "suspect" stream.
I am not quite sure what you mean since the files are written by text_oarchive etc, and should be read by corresponding streams such as text_iarchive. 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.
construction of an archive from a stream reads the serialization header. If the header doesn't contain what is expected - I think an exception is thrown.
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. Bo