Finding out executable location from a c program

Antti Karanta antti.karanta at napa.fi
Mon Nov 19 08:06:34 PST 2007



                       Hi!

   I would need to find out the directory where the current executable  
resides to find some stuff whose location I know relative to the  
executable location.

   On linux /proc/{pid}/exe is a symbolic link to the executable, on  
solaris the corresponding symlink is /proc/{pid}/path/a.out, on windows I  
can use GetModuleFileNameA, but I haven't been able to find any way to do  
this on os-x.

   Any ideas?



       -Antti-






More information about the MacOSX-dev mailing list