The ifx_putenv() function

The ifx_putenv() function changes the value of an existing environment variable, creates an environment variable, or removes a variable from the runtime environment.

Syntax

int ifx_putenv( envstring );
   const  char *envstring;
envstring
A pointer to a string of the form varname=string, in which varname is the name of the environment variable to add or modify and string is the variable value.

Usage

The ifx_putenv() function adds new environment variables or modifies the values of existing environment variables in the InetLogin structure. These variables define the environment in which a process executes. If varname is already part of the environment, ifx_putenv() replaces the existing value with string; otherwise, ifx_putenv() adds varname to the environment, with the value string.

To remove a variable from the runtime environment, specify varname to its default value. If the default value is NULL, setting the variable to a null string with ifx_putenv() effectively removes it from the runtime environment. If the default value of the variable is not NULL, then setting the variable to a null string with ifx_putenv() resets the variable to its default value, but does not remove it from the runtime environment.

The ifx_putenv() function sets HCL OneDB™ variables first and then other variables. For a list of HCL OneDB environment variables, see Fields of the InetLogin structure.

The following call to the ifx_putenv() function changes the value of the INFORMIXDIR environment variable:
ifx_putenv( "informixdir=c:\informix" );

This function affects only the environment variable of the current process. The environment of the command processor does not change.

Return codes

0
The call to ifx_putenv() was successful.
-1
The call to ifx_putenv() was not successful.