Boost logo

Boost Users :

Subject: Re: [Boost-users] incompatible serialization format of boost::property_tree between 1.44 and 1.48 (Robert Ramey)
From: kpzhang (sail4dream_at_[hidden])
Date: 2011-12-13 02:40:02


Hi Robert,

os: windows 7
compiler: visual studio 2008
sample code:

#include <iostream>
#include <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
int main()
{
    std::string str;
    {
        std::stringstream sstr;
        boost::property_tree::ptree pt;
        char a= '\0';
        pt.put("a",a);
        boost::property_tree::write_json(sstr, pt);
        str = sstr.str();
        std::cout << str << std::endl;
    }
     {
        std::stringstream sstr(str);
        boost::property_tree::ptree pt;
        boost::property_tree::read_json(sstr, pt);
        char a = '\1';
        std::cout << (int)pt.get("a",a) << std::endl;

    }
    return 0;
}



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net