...
| 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 optionalenvpargument 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
getenvfunction searches the list of environment variables forvarname.getenvis not case sensitive in the Windows operating system.getenvand_putenvuse the copy of the environment pointed to by the global variable_environto access the environment.getenvoperates 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 theenvpargument tomainorwmainmay 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] |
...