#include <stdlib.h> char *getenv(const char *name);Service Program Name: QP0ZCPA
The getenv() function searches the job-level environment list for a string of the form name=value, where name is the environment variable and value is the value of the variable.
The name parameter does not include the equal (=) symbol or the value of the environment variable name=value pair.
None.
value | getenv() successfully found the environment string. The value returned is a pointer to the string containing the value for the specified name in the current environment. |
NULL | getenv() could not find the environment string. The errno variable is set to indicate the error. |
If getenv() is not successful, errno indicates one of the following errors.
A damaged object was encountered.
A referenced object is damaged. The object cannot be used.
The address used for an argument is not correct.
In attempting to use an argument in a call, the system detected an address that is not valid.
While attempting to access a parameter passed to this function, the system detected an address that is not valid.
No such path or directory.
The directory or a component of the path name specified does not exist.
A named file or directory does not exist or is an empty string.
No entry found for name specified.
Unknown system state.
The operation failed because of an unknown system state. See any messages in the job log and correct any errors that are indicated, then retry the operation.
See Code disclaimer information for information pertaining to code examples.
See the example of using getenv() in putenv()--Change or Add Environment Variable.
For other examples, see the following:
Top | UNIX-Type APIs | APIs by category |