c++ - C, Linux, getcwd/chdir(): get binary path -


I want to open several files (log 4 CFF configs, other logs, etc.) relative to binary location.

Unfortunately, both getwd () and getcwd () are giving me the directory, from which I try to run binary on the known path Instead of giving me the path, binary (and where the data is located) is located.

How to use the app's path with chdir () ? Any method without trying to parse argv [0] and / proc / $ PID / (which is not enough portable) ?

What kind of things it really lives for, and supporting those standard directories is very important If you ever want someone compared to the programmer who wants your software to use it. To debug your home directory, pass a different - prefix = value to configure .

Comments