Boost property-tree access violation

aamrabd

New Member
I have been trying to parse an XML file using boost's property tree, but every time I want to get the value of a string it throws an access violation exception. It works fine with integers so I'm a bit confused.Here's some of the code:\[code\]class Config{ char * test; int test2;public: Config();};Config::Config(void){ boost::property_tree::ptree pt; boost::property_tree::xml_parser::read_xml("config.xml", pt); try { test = pt.get<char*>("base.char"); test2 = pt.get<int>("base.int"); } catch(std::exception e) { //something wasn't specified }}\[/code\]And the XML file:\[code\]<base> <char>test</char> <int>10</int></base>\[/code\]First I thought it's because I didn't allocate space for the string but neither malloc() nor new char[] helped.Any help would be appreciated. Thanks in advance :)
 
Back
Top