【问题标题】:boost::property_tree::json_parser::read_json cannot read files if path contains cyrillic charactersboost::property_tree::json_parser::read_json 如果路径包含西里尔字符则无法读取文件
【发布时间】:2014-12-02 11:22:33
【问题描述】:

是否可以打开路径中包含西里尔字母的文件?我能够读取/写入文件的西里尔文内容,但我不知道如何打开文件

json_parser::read_json 

只有 std::string 作为参数,没有 std::wstring。谁能帮帮我?

【问题讨论】:

    标签: c++ boost boost-propertytree


    【解决方案1】:

    这是继承自 C++ 标准流的限制。 Microsoft 的流有一个非标准扩展来接受 wstring 路径,但 PTree 不允许它们。

    尝试使用 Boost.Filesystem 的流。在函数外打开流,将打开的流传递给read_json

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-14
      • 2012-05-02
      • 2017-09-10
      • 1970-01-01
      • 1970-01-01
      • 2020-02-05
      • 2021-06-10
      • 2019-11-19
      相关资源
      最近更新 更多