【问题标题】:Boost property tree to string将属性树提升为字符串
【发布时间】:2014-12-04 18:52:39
【问题描述】:

需要通过 Internet 传输存储在 ini 文件中的系统配置。我正在使用 boost 来处理配置 ini 文件。如何将整个属性树保存到字符串?

【问题讨论】:

    标签: c++ boost


    【解决方案1】:

    只需写信给std::stringstream

    std::ostringstream oss;
    boost::property_tree::ini_parser::write_ini(oss, my_ptree);
    
    std::string inifile_text = oss.str();
    

    酌情替换为wstring/wostringstream

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-02
      • 1970-01-01
      • 2012-05-21
      相关资源
      最近更新 更多