Tinyxml Multi Task

Posted by shaimagz on Stack Overflow See other posts from Stack Overflow or by shaimagz
Published on 2010-03-09T01:29:11Z Indexed on 2010/03/09 1:36 UTC
Read the original article Hit count: 413

I have a single xml file and every new thread of the program (BHO) is using the same Tinyxml file.

every time a new window is open in the program, it runs this code:

const char * xmlFileName = "C:\\browsarityXml.xml";
TiXmlDocument doc(xmlFileName);
doc.LoadFile();
//some new lines in the xml.. and than save:
doc.SaveFile(xmlFileName);

The problem is that after the first window is adding new data to the xml and saves it, the next window can't add to it. although the next one can read the data in the xml, it can't write to it.

I thought about two possibilities to make it work, but I don't know how to implement them:

  1. Destroy the doc object when I'm done with it.
  2. Some function in Tinyxml library to unload the file.

Any help or better understanding of the problem will be great. Thanks.

© Stack Overflow or respective owner

Related posts about tinyxml

Related posts about c++