Reputation: 11
I am using Boost property tree classes to read and write MS Ini-files. One of the section name contains a literal dot as part of the string. There is no hierarchy. How can I quote this dot?
[system-no.1]
acq=3
Upvotes: 1
Views: 448
Reputation: 393164
You can only by creating paths with an alternative separator:
#include <boost/property_tree/ini_parser.hpp>
#include <iostream>
using boost::property_tree::ptree;
int main() {
ptree::path_type path("system=no.1#acq", '#');
ptree pt;
pt.put(path, 3);
write_ini(std::cout, pt);
}
Prints
[system=no.1]
acq=3
Because the contructor is not explicit you can abbreviate to:
pt.put({"system=no.1#acq", '#'}, 3);
Upvotes: 1