Linuxで構成INIファイルを解析しようとしています。Boostを使用したいのですが、誰かがprogram options
ライブラリを教えてくれました。
問題は、構文を含む行を読み取ることができるということですがfield=value
、さまざまなセクション、つまりその中にある行をどのように処理するの[Section_Name]
ですか?以下のコードでは、常に例外があります
私が試したコードの下。ありがとうAFG
const char* testFileName = "file.ini";
std::ifstream s;
s.open( testFileName );
namespace pod = boost::program_options::detail;
std::set<std::string> options;
options.insert("a");
options.insert("b");
options.insert("c");
//parser
for (pod::config_file_iterator i(s, options), e ; i != e; ++i)
{
std::cout << i->value[0] << std::endl;
}