I got this exception : "libc++abi.dylib: terminating with uncaught exception of type boost::archive::archive_exception: input stream error-No such process terminating with uncaught exception of type boost::archive::archive_exception: input stream error-No such process (lldb) " in my program when deserialize from xml file.
My program :
#include<iostream>
#include<fstream>
#include<boost/archive/xml_oarchive.hpp>
#include<boost/archive/xml_iarchive.hpp>
int main(){
std::string fname = "file.xml";
{
std::string a("hello world");
std::ofstream of(fname.c_str());
boost::archive::xml_oarchive of_xml(of);
of_xml << BOOST_SERIALIZATION_NVP(a);
of.close();
}
{
std::string b;
std::ifstream inf(fname.c_str());
boost::archive::xml_iarchive inf_xml(inf);
inf_xml >> BOOST_SERIALIZATION_NVP(b);
inf.close();
std::cout<<"string is : "<<b<<"\n";
}
return 0;
}
How to handle this exception guys?
Aucun commentaire:
Enregistrer un commentaire