Searches the environment-variable table for a specified entry.
#include <stdlib.h> char *getenv (const char *varname);
errno_t getenv_s (size_t *valuelenresult, char *value,
rsize_t maxsize, const char *varname);
varname
varname
argument should match the case of the environment variable.
valuelenresult
value
maxsize
getenv is case-sensitive.
getenv operates only on the local process. The process environment is pre-loaded from "global" values which are set in the registry. The registry INtime\RtKernelLoader\INTIME.INI\CLIB contains values which are loaded into the environment.
The first call to getenv sets up an environment-variable table shared by all threads using the C library. A prototype for the table is contained in the file :config:r?env. When getenv is called for the first time, the table is initialized from :config:r?env. You can create an environment-variable file locally, :prog:r?env, that getenv uses in addition to :config:r?env, as a basis for the table. The maximum allowable number of entries in the environment-variable table is 40. Entries in the r?env files are of this form:
varname = [ASCII string]
A space character is required on both sides of the equal sign for fscanf parsing. For example, a typical entry in :config:r?env appears like this:
TZ = PST8PDT
getenv_s returns zero if the environment variable was found, non-zero if it was not found or if a runtime constrant violation occurred. On any error, writes zero to valuelenresult (unless valuelenresult is a null pointer).
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/stdlib.h | stdlib.h | clib.lib |