Environment Names

The set of environment names and the method for altering the environment list used by the getenv function (§4.10.4.4)

The set of environment names is unlimited.

To change environment variables from within a C program, call the putenv function. To change environment variables from the DOS command line, use the SET command (for example, SET LIB = D:\LIBS).

Environment variables exist only as long as their host copy of DOS is running. For example, the line

system( “SET LIB = D:\LIBS” );

would run a copy of DOS, set the environment variable LIB, and return to the C program, exiting the secondary copy of DOS. Exiting that copy of DOS removes the temporary environment variable LIB.

Likewise, changes made by the putenv function last only until the program ends.