Could anyone give me an example on how to use to use istream and ostream (<< and >> )to output to xml file and read from xml file with VC++.
Thank you
I believe you're supposed to use TiXmlDocument::LoadFile() and TiXmlDocument::OpenFile(). Let TinyXml worry about the streams.
This works for me in VC++ 6, SP5:
int main(int argc, char* argv[]) { TiXmlDocument doc("XML testdoc.txt"); TiXmlElement element("This works"); doc.InsertEndChild(element); doc.SaveFile(); return 0; }
Note there appears to be a pointer bug (#935500) when using TinyXml with aforementioned compiler & STL support on.
Log in to post a comment.
Could anyone give me an example on how to use to use istream and ostream (<< and >> )to output to xml file and read from xml file with VC++.
Thank you
I believe you're supposed to use TiXmlDocument::LoadFile() and TiXmlDocument::OpenFile(). Let TinyXml worry about the streams.
This works for me in VC++ 6, SP5:
int main(int argc, char* argv[])
{
TiXmlDocument doc("XML testdoc.txt");
TiXmlElement element("This works");
doc.InsertEndChild(element);
doc.SaveFile();
return 0;
}
Note there appears to be a pointer bug (#935500) when using TinyXml with aforementioned compiler & STL support on.