"Ferguson, Neale" <[EMAIL PROTECTED]> wrote:
>
> How do I, within a program, get the full pathname of the program I'm
> executing? argv[0] will have the command name but not necessarily the full
> pathname.
>
Neale,
In general, you have to know the name of the program (argv[0]
may be incorrect) and then have to look at the users PATH
environment to find it...
That is - you have to look at argv[0] to see if it's a direct
path specification (begins with '/' or '.'). If it's not,
then you look along the PATH environment variable to find
argv[0].
This approach does not work if the program is being exec'd
and the exec() call sets argv[0] to something strange.
- Dave Rivers -
--
[EMAIL PROTECTED] Work: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com