c++ - Reading XML: How to catch exceptions from ticpp::LoadFile()? -
i trying read xml file using ticpp::loadfile(); not successfull , did not know why because have no idea how catch exceptions. here did:
try { // load document ticpp::document doc( pfilename ); doc.loadfile(); // element chaining calls - no return values check, no tixmlhandle ticpp::element* pelem = doc.firstchildelement()->nextsibling(); // useful here } catch( ticpp::exception& ex ) { // if function has error, execution enter here. // report error std::cout << ex.what(); } but ex shows grayed if never declared. wondering how can catch exceptions in case?
it turned out file path messed up. code fine.
Comments
Post a Comment