Visual Studio 2005 and Tinyxml - xml file location

非 Y 不嫁゛ 提交于 2020-01-17 03:24:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!