Need GetModuleFileName for UNIX.
-
I'm writing a C++ console app for Windows and UNIX. When it runs, the app needs to know the directory where it's located. Of course, this may or may not be different from the working directory (which I don't care about). I need the directory where the app's file is at -- the equivalent of GetModuleFileName on Windows. Anyone have a clue? :confused: Thanks, Alvaro
-
I'm writing a C++ console app for Windows and UNIX. When it runs, the app needs to know the directory where it's located. Of course, this may or may not be different from the working directory (which I don't care about). I need the directory where the app's file is at -- the equivalent of GetModuleFileName on Windows. Anyone have a clue? :confused: Thanks, Alvaro
There are many flavors of UNIX. You will need to look at the system calls available for the flavor you are coding for.
-
I'm writing a C++ console app for Windows and UNIX. When it runs, the app needs to know the directory where it's located. Of course, this may or may not be different from the working directory (which I don't care about). I need the directory where the app's file is at -- the equivalent of GetModuleFileName on Windows. Anyone have a clue? :confused: Thanks, Alvaro
> When it runs, the app needs to know the directory where it's located. Check the first argument passed to "main(...)". That usually contains the path to the executable. -=- James.