如何才能让它支持中文路径?

using boost::property_tree::ptree;
ptree pt;
boost::array<string,400> tmpList;
read_xml(“E:\新建文件夹\test.xml”, pt);

会抛异常 can not open

慕码人2483693
浏览 124回答 2
2回答

沧海一幻觉

boost内部实际上用的是STL的串流有时候用ifstream或ofstream打开带有中文路径的文件会失败。解决办法:1、使用C语言的函数设置为中文运行环境setlocale(LC_ALL,"Chinese-simplified");2、使用STL函数设置为系统语言环境std::locale::global(std::locale(""));当然选2啦!

繁星淼淼

中文路径 转义一下吧 用 urlencode
打开App,查看更多内容
随时随地看视频慕课网APP