ID Number: Q43428
5.10 6.00 6.00a 6.00ax | 5.10 6.00 6.00a
MS-DOS | OS/2
Summary:
In Microsoft C versions 5.1, 6.0, 6.0a, and 6.0ax, a copy of the
master environment is stored in the program's near heap, which is part
of DGROUP, when a program is run.
More Information:
The ENVIRON variable is an array of pointers to the strings that
constitute the process's environment. The C startup code takes the
environment information and initializes the ENVIRON variable to point
to the environment table. The function getenv() uses the ENVIRON
variable to access the environment table. ENVIRON can be used to
obtain the environment table address directly.
The following program prints out the address of the beginning of the
environment table and the PATH environment variable:
Sample Code
-----------
#include <stdlib.h>
#include <stdio.h>
char *path;
void main (void)
{
path = getenv( "PATH" );
printf( "path: %s\nenviron: %x\n", path, environ );
}
Additional reference words: 6.0 6.00 6.0a 6.00a 6.0ax 6.00ax quickc
2.0 2.00 2.01 2.5 2.50 2.51