INtime SDK Help
setenv

Adds new environment variables or modifies the values of existing ones.

#include <stdlib.h>

int setenv(const char *name, const char *value, int overwrite);

Parameters

name
The name of the variable. This must not contain an '=' character.
value
The value of the variable to set.
overwrite
Determine whether an existing value is overwritten or not.

Remarks

The setenv function operates only on the local process. The process environment is pre-loaded from "global" values which are set in the registry. The registry ...\<nodename>\INTIME.INI\CLIB contains values which are loaded into the environment.

The setenv function updates or adds a variable in the environment of the calling process. The name argument points to a string containing the name of an environment variable to be added or altered. The environment variable shall be set to the value to which value points. The function shall fail if name points to a string which contains an '=' character. If the environment variable named by name already exists and the value of overwrite is non-zero, the function shall return success and the environment shall be updated. If the environment variable named by name already exists and the value of overwrite is zero, the function shall return success and the environment shall remain unchanged. The strings described by name and value are copied by this function.

Return Values

0 (zero).
Success.
-1
Failure. The value of errno is set as follows:
EINVAL
The envname argument points to an empty string or points to a string containing an '=' character.
ENOMEM
Insufficient memory was available to add a variable or its value to the environment.

Requirements

Versions Defined in Include Link to
INtime 6.0 intime/rt/include/stdlib.h stdlib.h clib.lib
   
See Also

Environment