Menu

tinyxml document file into string.

2007-08-04
2013-05-20
  • Kiran Parmar

    Kiran Parmar - 2007-08-04

    Hi,

    I want to convert tinyxml document file into string. I have found on google as well as tinyxml document but I haven't solve it. What I have done so far is

         TiXmlDocument doc("xyz.xml");
         TiXmlElement * root = new TiXmlElement( "login" );  
          root->SetAttribute("username","name");  
          root->SetAttribute("password", "pwd"); 
          doc.LinkEndChild(root); 
          doc.SaveFile();  
          String str = "";

    I want to insert the file xyz.xml data into this string str. If it is char*, then it is also ok. Can anybody help me?

    Regards

     
    • Ellers

      Ellers - 2007-08-04

      If your question is to read a *file* into a string (that is, *not* about taking a TiXmlDocument and putting it into a string) then google for fopen(), mmap, and ifstream. My personal favourite method is mmap but its not always practical.

      HTH

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.