home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!wirzeniu
- From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
- Newsgroups: comp.lang.c
- Subject: Re: How can a program know where it was invoked?
- Message-ID: <1992Aug13.121213.24939@klaava.Helsinki.FI>
- Date: 13 Aug 92 12:12:13 GMT
- References: <1992Aug9.024844.6230@debbie.cc.nctu.edu.tw> <31460023@hpcuhe.cup.hp.com> <1992Aug12.141025.778@mnemosyne.cs.du.edu>
- Organization: University of Helsinki
- Lines: 11
-
- ebergman@nyx.cs.du.edu (Eric Bergman-Terrell) writes:
- >What about looking at argv[0]. Isn't this a reasonably portable way of
- >ascertaining the pathname of the executable?
-
- No. It won't work in most systems. It happens to work with some C
- compilers on some versions of MS-DOS. It most probably doesn't work
- under Unix, since the path is almost never stored into argv[0], only the
- filename.
-
- --
- Lars.Wirzenius@helsinki.fi
-