[comp.sys.ibm.pc] Getting programme dir

kaleb@mars.jpl.nasa.gov (Kaleb Keithley) (05/25/90)

In article <127@evtprp0b.UUCP> tea6219@evtprp0b.UUCP (Terry E. Acker) writes:
>In MSC 5.0, there is a function (I believe its called getenv) that can access the environment passed to the program.  In the environment is the PATH variable, which you will be able to inspect.

And if you declare main as follows:

int main (argc, argv, envp)
int argc;
char **argv;
char **envp; {}

then envp points to a null terminated array of all the environment parameters.
just like argv points to a null term'd array of all the command line options.

kaleb@thyme.jpl.nasa.gov            Jet Propeller Labs
Kaleb Keithley

PHYS169@canterbury.ac.nz (Mark Aitchison, U of Canty; Physics) (05/28/90)

In article <127@evtprp0b.UUCP>, tea6219@evtprp0b.UUCP (Terry E. Acker) writes:
> In MSC 5.0, there is a function (I believe its called getenv) that can access
> the environment passed to the program.  In the environment is the PATH 
> variable, which you will be able to inspect.

Late model DOS's put the full pathname after the environment (i.e. after the
double null bytes). You can use Turbo Pascal's PARAMSTR(0) to get it easily.

Mark Aitchison.