putenv(3)putenv(3)Nameputenv - change or add value to environment
Syntax
int putenv (string)
char ∗string;
Description
The string points to a string of the form ``name=value.'' The subrou‐
tine makes the value of the environment variable name equal to value by
altering an existing variable or creating a new one. In either case,
the string pointed to by string becomes part of the environment, so
altering the string will change the environment. The space used by
string is no longer used once a new string-defining name is passed to
Diagnostics
The subroutine returns nonzero if it was unable to obtain enough space
via for an expanded environment, otherwise zero.
Warnings
The subroutine manipulates the environment pointed to by and can be
used in conjunction with However, envp (the third argument to main) is
not changed.
This routine uses to enlarge the environment.
After is called, environmental variables are not in alphabetical order.
A potential error is to call with an automatic variable as the argu‐
ment, then exit the calling function while string is still part of the
environment.
See Alsoexecve(2), getenv(3), malloc(3), environ(7)putenv(3)