Microsoft KB Archive/43428

= INFO: Storage of Environment Variables =

Article ID: 43428

Article Last Modified on 12/12/2003

-

APPLIES TO

 The C Run-Time (CRT), when used with:  Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 1.5 Professional Edition

 Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 2.0 Professional Edition</li></ul>

 Microsoft Visual C++ 4.0 Standard Edition</li></ul>

 Microsoft Visual C++ 5.0 Standard Edition</li></ul>

 Microsoft Visual C++ 6.0 Service Pack 5</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q43428

<div class="notice_section">

<div class="summary_section">

SUMMARY
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

 * 1) include <stdlib.h>
 * 2) include <stdio.h>

char *path;

void main (void) { path = getenv( &quot;PATH&quot; ); printf( &quot;path: %s\nenviron: %x\n&quot;, path, environ ); }

Keywords: kbinfo kbcrt kbcode KB43428

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.