The documentation doesn't really say.
I get that I can hand it an ifstream, so I could check to make sure it's open, so that case is mostly dealt with.
But when doing boost::property_tree::ini_parser::read_ini(ifstream_object,property_tree_object);
How do I detect if the file was in a bad format? Is there any way for me to get diagnostic information, such as where the parse failed?
Just catch exceptions. Base PropertyTree exception class is
boost::property_tree::ptree_error
which derives fromstd::runtime_error
, and it has two descendants:ptree_bad_data
andptree_bad_path
.Example:
Output is: