vico
vico

Reputation: 18251

Boost property tree to string

Need to transfer system configuration that is stored in ini file over internet. I'm using boost to deal with configuration ini file. How to save whole property tree to string?

Upvotes: 10

Views: 10484

Answers (1)

sehe
sehe

Reputation: 394054

Just write to a std::stringstream:

std::ostringstream oss;
boost::property_tree::ini_parser::write_ini(oss, my_ptree);

std::string inifile_text = oss.str();

Replace with wstring/wostringstream as appropriate

Upvotes: 14

Related Questions