-

Changes

Jump to: navigation, search

Functions HI-TECH C GETENV

1,262 bytes added, 20:22, 31 July 2017
Created page with "<strong>GETENV</strong> ==SYNOPSIS== #include <stdlib.h> char * getenv(char * s) extern char ** environ; ==DESCRIPTION== <strong>Getenv</strong>() will search the..."
<strong>GETENV</strong>
==SYNOPSIS==

#include <stdlib.h>

char * getenv(char * s)
extern char ** environ;


==DESCRIPTION==
<strong>Getenv</strong>() will search the vector of environment strings
for one matching the argument supplied, and return the
value part of that environment string. For example, if
the environment contains the string

COMSPEC=A:\COMMAND.COM

then <strong>getenv("COMSPEC")</strong> will return A:\COMMAND.COM. The
global variable environ is a pointer to an array of
pointers to environment strings, terminated by a null
pointer. This array is initialized at startup time
under MS-DOS from the environment pointer supplied when
the program was executed. Under CP/M no such environment is supplied, so the first call to <strong>getenv</strong>() will
attempt to open a file in the current user number on
the current drive called ENVIRON. This file should contain definitions for any environment variables desired
to be accessible to the program, e.g.

HITECH=0:C:

Each variable definition should be on a separate line,
consisting of the variable name (conventionally all in
upper case) followed without intervening white space by
an equal sign ('=') then the value to be assigned to
that variable.

Navigation menu