◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back► ─────Run-Time Library─────────────────────────────────────────────────────── The getenv function searches the list of environment variables for an entry corresponding to <varname>. Environment variables define the environment in which a process executes. (For example, the LIB environment variable defines the default search path for libraries to be linked with a program.) Because the getenv function is case sensitive, the <varname> variable should match the case of the environment variable. Environment-table entries must not be changed directly. If an entry must be changed, use the _putenv function. To modify the returned value without affecting the environment table, use _strdup or strcpy to make a copy of the string. The getenv and _putenv functions use the global variable _environ to access the environment table. The _putenv function may change the value of _environ, thus invalidating the <envp> argument to the main function. Therefore, it is safer to use the _environ variable to access the environment table. Both the getenv and the _putenv functions operate only on the data structures accessible to the run-time library and not on the environment "segment" created for the process by the operating system. Return Value The getenv function returns a pointer to the environment-table entry containing the current string value of <varname>. The return value is NULL if the given variable is not currently defined. -♦-