问题
For some reason my Tinyxml file which is created via visual studio 2005 (c++) is saved on my desktop instead of the debug folder or in the program's root folder.
if anyone knows about some way to tell vs2005 to save the tinyxml create file somewhere else?
I tried that with eclipse and it saved the file in the program's root folder, which is what I'm trying to do.
thanks.
EDIT: I'm doing a BHO (Browser Helper Object), this is an add-on Internet Explorer. so when I run my program the 'exe' is iexplore.exe from c:\program files\Intenet Explorer
回答1:
You normally shouldn't aspire to write data files to your program directory. Rather than leaving the output directory to chance, you should explicitly tell TinyXml where you want the file created by passing in the whole path when you call SaveFile.
回答2:
Make sure you have set the working directory to $(OutDir) in "Project Properties->Debugging"
and then just call:
TiXmlDocument tiXmlDocument;
tiXmlDocument.SaveFile( "bleh.xml" );
That file should then be in the same directory as your exe.
Edit: If its an add on to internet explorer than I don't know where the working directory would be, but im sure there would be some environment variable or something provided by internet explorer that would give you a temp directory or something.
来源:https://stackoverflow.com/questions/2376468/visual-studio-2005-and-tinyxml-xml-file-location