Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

getenv - get value of environment variable

&pagelevel(4)&pagelevel

Syntax

#include <stdlib.h>

char *getenv(const char *name);

Description

getenv() searches the current environment of the process, i.e. the string array pointed to
by environ, for a string of the form "name=value" and returns a pointer to the string
containing the value for the specified variable name.

getenv() is not thread-safe.

Return val.

Pointer to a string with value of name


if a corresponding string exists.

Null pointer

if no corresponding string exists.

Notes

The string "name=value" cannot be altered, but may be overwritten by subsequent putenv calls. Other library functions do not overwrite the string.

BS2000
The string array to which environ points can be initialized with values from the SDF-P variable SYSPOSIX.name on starting the program (see environ and the section Environment variables”). (End)

See also

exec, environ, putenv(), setenv(), unsetenv(), stdlib.h, and section Environment variables”.