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