$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
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!