Just a quick question:
My application reads in an INI file that it needs to access, which is found in the same folder as the executable itself. I used to have the folder name for the executable (and so the INI file) hardcode into the source, but I'd prefer the flexibility of locating the program and its data file in ANY folder.
I tried using the curdir function. This seemed to work fine when I launched it from explorer. However, if I call it from the command line (eg. P:\folder\MyApp.exe) then curdir picks up the folder I'm currently in, not P:\folder as I'd like.
So, is there an function similar to curdir which instead identifies the directory in which the executable resides?
I've been having a look round the 'net, but no joy yet.
Any help would be much appreciated.
My application reads in an INI file that it needs to access, which is found in the same folder as the executable itself. I used to have the folder name for the executable (and so the INI file) hardcode into the source, but I'd prefer the flexibility of locating the program and its data file in ANY folder.
I tried using the curdir function. This seemed to work fine when I launched it from explorer. However, if I call it from the command line (eg. P:\folder\MyApp.exe) then curdir picks up the folder I'm currently in, not P:\folder as I'd like.
So, is there an function similar to curdir which instead identifies the directory in which the executable resides?
I've been having a look round the 'net, but no joy yet.
Any help would be much appreciated.