#include #include #include namespace po = boost::program_options ; int main(int argc, char **argv) { std::ifstream file ; file.exceptions(std::ifstream::failbit | std::ifstream::badbit) ; po::options_description options_ ; try { file.open("test.cfg") ; std::cout << "opening test.cfg: failbit: " << file.fail() << " - badbit: " << file.bad() << std::endl ; std::cout << "let s call parse_config_file()..." << std::endl ; po::parse_config_file(file, options_) ; } catch(std::ios::failure const & exc) { std::cout << "ios failure: failbit: " << file.fail() << " - badbit: " << file.bad() << std::endl ; std::cout << "perror() value : " << std::flush ; perror("test.cfg") ; } }