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:
- Destroy the doc object when I'm done with it.
- Some function in Tinyxml library to unload the file.
Any help or better understanding of the problem will be great. Thanks.