Re: [Dev-C++] rookie question... Getting the current directory
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <or...@vp...> - 2002-12-27 13:39:32
|
Hello! > Windows uses GetCurrentDirectory() Well, you have to be careful with this function, because it not always gives the directory, where the program executable is! Whenever you press enter (or double-click) on a file, which is associated to your program, then the current directory will be the dir, where the associated file is, NOT the dir of your exe! This can be annoying, when you want to write config-files. To retrieve your programs path, use __argv[0]. This contains the path to your program (for example: "C:\myprog\myprog.exe"). The other __argv[] elements contain the command-line arguments. Hope that helps. -- Regards Balázs |