...
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 library and not on the environment "segment" created for the process by the operating system. Therefore, programs that use theenvp
argument tomain
orwmain
may retrieve invalid information.
Non-Compliant
...
Code Example
This non-compliant code example compares the value of the TMP
and TEMP
environment variables to determine if they are the same. This code example is non-compliant because the string referenced by tmpvar
may be overwritten as a result of the second call to getenv()
function. As a result, it is possible that both tmpvar
and tempvar
will compare equal even if the two environment variables have different values.
...