Getting path to executed program file
Tom Lane
tgl at zog.cs.cmu.edu
Wed Jul 25 08:11:51 AEST 1990
Is there any way for a program to discover the path name of the file
from which it was executed?
I would like to be able to access auxiliary files stored in the same
directory as the main executable file. However, after reading the
man page for exec(2), it doesn't seem like the program gets enough
information to reliably determine what file/directory it was loaded
from. (For one thing, you don't know whether PATH was used, and for
another, you don't know whether argv[0] is the same as the supplied
path or is just the last component.) If the info is in fact
squirrelled away somewhere, please tell me where!
--
tom lane
Internet: tgl at cs.cmu.edu
UUCP: <your favorite internet/arpanet gateway>!cs.cmu.edu!tgl
BITNET: tgl%cs.cmu.edu at cmuccvma
CompuServe: >internet:tgl at cs.cmu.edu
More information about the Comp.unix.wizards
mailing list