以下解决方法转自百度知道:http://zhidao.baidu.com/question/335129108.html
using boost::property_tree::ptree; ptree pt; boost::array<string,400> tmpList; read_xml(“E:\新建文件夹\test.xml”, pt); 会抛异常 can not open 如何才能让它支持中文路径
满意回答
2011-10-28 22:19
boost内部实际上用的是STL的串流 有时候用ifstream或ofstream打开带有中文路径的文件会失败。 解决办法: 1、使用C语言的函数设置为中文运行环境 setlocale(LC_ALL,"Chinese-simplified"); 2、使用STL函数设置为系统语言环境 std::locale::global(std::locale("")); 当然选2啦!
boost::property_tree::wptree wpt;
std::locale::global(std::locale(""));
boost::property_tree::xml_parser::read_xml("E:\\新建文件夹\\test.xml",wpt);
经试用,方法是成功的。