保存:

//xml的实体
    TiXmlElement* rootElement = new TiXmlElement("spark");
    rootElement->SetAttribute("name", m_sParticleName.c_str());


    //建立xml用于保存
    TiXmlDocument *doc = new TiXmlDocument;
    //声明
    TiXmlDeclaration *dec = new TiXmlDeclaration("1.0", "utf-8", "");
    doc->LinkEndChild(dec);
    doc->LinkEndChild(rootElement);
    doc->SaveFile(_xmlOutFilePath.c_str());

 

读取:

TiXmlDocument *doc = new TiXmlDocument;
    doc->LoadFile(_xmlFilePath.c_str());

 

相关文章:

  • 2021-09-26
  • 2021-07-10
  • 2021-09-02
  • 2021-09-05
  • 2021-06-23
  • 2022-12-23
猜你喜欢
  • 2021-10-26
  • 2022-12-23
  • 2021-08-20
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案