I was wondering how I could get the file name string from an archive, inside the serialize function or any other function that has the template<class archive> syntax.
Thanks! =)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no portable way of doing what you ask. The archive concept does not require using a file, nor does it even require using a C++ iostream-derived class. All of the libraries archive types use an iostream, but even those don’t have to be file streams.
You could create your own archive type of course. One specifically for files. Possibly derived from an existing one, passing arguments to the base class. It would have an extra function to get the name of the file that was used to create it.