Boost logo

Boost Users :

Subject: [Boost-users] boost.program_options - reloading configuration file
From: Aljaz (aljaz.fajmut_at_[hidden])
Date: 2008-10-15 17:38:16


Hello

I want to implement function in my application which would allow me to
reload the configuration file.

At the moment I have all neccessary program_options objects inside a
configuration class, and when I do:

bool configuration::reload_config_file(std::string filename) {
try {
    std::ifstream ifs(filename.c_str());
    if (!ifs.is_open()) return false;

    boost::program_options::store(boost::program_options::parse_config_file(ifs,
m_config), m_variables);
    boost::program_options::notify(m_variables);

    ifs.close();
}
catch (std::exception &e) {
    return false;
}
   return true;
}

The options will stay the same although the configuration file is different.
Should I somehow clear the m_variables object?

Many thanks in advance!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net