/ * GetENV.C: this Program Uses GetENV to Retrieve
* The lib environment variable and the uses
* _putev to change it to a new value.
* /
#include
#include
Void main (void)
{
Char * libvar;
/ * Get The value of the lib environment variable. * /
Libvar = getenv ("lib");
IF (Libvar! = NULL)
Printf ("Original Lib Variable IS:% S / N", Libvar);
/ * Attempt to change path. Note That this only affects the environment
* Variable of the current process. The Command Processor's environment
* is not changed.
* /
_putenv ("lib = c: // mylib; c: // YourLib");
/ * Get new value. * /
Libvar = getenv ("lib");
IF (Libvar! = NULL)
Printf ("New Lib Variable IS:% S / N", LIBVAR);
}
OUTPUT
Original Lib Variable IS: C: / Progra ~ 1 / DevStu ~ 1 / VC / LIB
New lib Variable IS: C: / MYLIB; C: / YourLib