...
Wiki Markup |
---|
According to C99 \[[ISO/IEC 9899-:1999|AA. C References#ISO/IEC 9899-1999]\]: |
Wiki Markup In a hosted environment, the main function receives a third argument, {{char \*envp\[\]}}, that points to a NULLnull-terminated array of pointers to {{char}}, each of which points to a string that provides information about the environment for this execution of the program.
...
Unanticipated results may occur if
setenv()
changes the external variableenviron
. In particular, if the optionalenvp
argument tomain()
is present, it is not changed, and thus as a result may point to an obsolete copy of the environment (as may any other copy ofenviron
).
...
The
getenv
function searches the list of environment variables forvarname
.getenv
is not case sensitive in the Windows operating system.getenv
and_putenv
use the copy of the environment pointed to by the global variable_environ
to access the environment.getenv
operates only on the data structures accessible to the run-time runtime library and not on the environment "segment" created for the process by the operating system. ThereforeConsequently, programs that use theenvp
argument tomain
orwmain
may retrieve invalid information.
...
Wiki Markup |
---|
\[[ISO/IEC 9899-:1999|AA. C References#ISO/IEC 9899-1999]\] Section J.5.1, "Environment Arguments" \[[Open Group 04|AA. C References#Open Group 04]\] [{{setenv()}}|http://www.opengroup.org/onlinepubs/009695399/functions/setenv.html] |
...