c++ - Detect executable folder from SDL -


I am creating a C ++ SDL game engine, and the executable route from not being able to store images and other resources Understanding is relevant in the executable - they are in separate folders ("res /"). "Under Linux, I am using shell script" rungame.sh "which is on the executable path of CD and then execute Runs Qualified (Then use "./" to perform executable fo Refer to address) However, I believe this is an "ugly" approach and I want it to be Windows-compatible.

In addition to this, the current approach is not very good because it has some command The meaning of the line arguments can change. / P>

I want a cross-platform (* NIX, Windows and Mac OS X, if possible) solution to achieve the current path of executable. The executable name changed

What is the most obvious way to resolve my problem (possibly using std :: string and as much as a few platform-dependent APIs)?

I recommend before posting:


Comments