Posted: 10th Nov 2011 13:05
I'm using C++ in conjunction with AGK. I make a template in the set (VS9). I also use a parser TinyXML. In an attempt to access a file produces an error reading(to xml file). For a long time trying to find bug and as a result discovered that the path to the file then go bad.

I do so
+ Code Snippet
char buf[512];
GetCurrentDirectoryA(512, buf);


result:
+ Code Snippet
 buf = 0x0012f7e8 "C: \ Documents and Settings \ Vlad \ My Documents \ AGK \ e_Work__2D_Engine_Projects_ConnectIt_templateexe"


Why did he refer to my documents and whether it can be overcome?
Posted: 10th Nov 2011 13:22
The reason this happens is to ensure compatibility when running on other platforms. If you want to write to the same directory as your executable you can always override this by using GetModulePath and SetCurrentDirectory.
Posted: 10th Nov 2011 13:53
Hmmm, and how to use GetModulePath?
And it does not hurt for cross-platform?
Posted: 11th Nov 2011 8:24
Ok, I have everything turned out. Did not even use SetCurrentDirectory. Thank you very much.
But one question remains misunderstood. Cross-platform does not spoil?
Posted: 12th Nov 2011 0:49
The moment you use a proprietary command such as SetCurrentDirectory (i.e. a command not starting with agk: then you are tied to that particular compiler and platform SDK. To keep cross platform universal compatibility, you cannot use 'hacks' such as using SetCurrentDirectory or similar. The reason is that not all platforms would allow you to change your directory.