Use following version of function
template<typename Ptree>
void write_xml
(
std::basic_ostream< typename Ptree::key_type::value_type > & stream,
const Ptree & pt,
const xml_writer_settings< typename Ptree::key_type::value_type > & settings =
xml_writer_settings< typename Ptree::key_type::value_type >()
);
write_xml(std::cout, pt);
for output in console
std::ostringstream oss;
write_xml(oss, pt);
for output in stringstream
(you can output stringstream
contents in console, by using str
function of stringstream
).