Boost logo

Boost :

Subject: [boost] is there a bug in ini_parser.hpp?
From: Bernd Prager (bernd_at_[hidden])
Date: 2010-12-10 01:02:24


Hi,

Following program does not pertain a proper "other" value:

#include <iostream>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>

using namespace std;
using boost::property_tree::ptree;

int main() {
     ptree pt;
     pt.put("debug.filename", "tst.log");
     pt.put("other", "tst");
     cout << "debug.filename: " << pt.get("debug.filename", "filename
not found")
<< endl << "other: " << pt.get("other", "other not found") << endl;
     boost::property_tree::write_ini("tst.ini", pt);
     boost::property_tree::read_ini("tst.ini", pt);
     cout << "debug.filename: " << pt.get("debug.filename", "filename
not found")
<< endl << "other: " << pt.get("other", "other not found") << endl;

     return EXIT_SUCCESS;
}

The ini file contains:
[debug]
filename=tst.log
other=tst

Do I do anything wrong or is that a bug?

Thanks for help or suggestions,
-- Bernd


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk