I have a C++ program which I need to get the full path to as I need to store game assets in a datbase. I am connecting via odbc so need ot make a DSN string. Now, I have it working but I need to put a literel path into the database string, which is in the same directory as the executable.
If I change the place the .exe is , which i routinely do, I need to change the conenction string.
So I was looking for a C++ windows API call which returns the path of the directory of the executable.
Can anyone shed any light on this , any google search I make returns lots of USELESS results ?
Cheers in advance guys and gals,
Rob
In C and C++ applications argv[0] is set to the executables path. If you’re using C++, I highly recomend boost (boost.org) and its filesystem libraries.