Environment Strings Beckemeyer Development Tools ENV.O contains two functions from the UNIX (tm) run-time library. It is provided at no extra cost to purchasers of MICRO C-Tools. The distribution diskette contains the C source file in the \SRC directory. Descriptions of the two functions follow: Getenv ------ char *getenv(name) char *name; /* name of environment variable */ The getenv function searches the envronment table for the given variable. It returns a pointer the value of the variable, or a NULL pointer if the variable cannot be found. Putenv ------ int putenv(string) char *string; The putenv function adds a new environment variable or modifies an existing one. String must be a pointer to a string of the form: name=value where name is the name of the environment variable to add or modify, and value is the value to assign to that variable. Putenv returns 0 if it is successfull. A return value of -1 indicates an error. IMPORTANT NOTES --------------- You cannot modify the environment directly. Always use the putenv function to add or change environment variables. To change the value of the string returned by getenv without affecting the environment, use strcpy to make a copy of the string.