The ifx_getenv() function
The ifx_getenv() function retrieves the value of a current environment variable.
Syntax
char *ifx_getenv( varname );
const char *varname;
- varname
- A pointer to a buffer that contains the name of an environment variable.
Usage
- Table of HCL OneDB™ environment variables that the application has modified or defined with the ifx_putenv() function or directly (the InetLogin structure)
- Table of HCL OneDB environment variables that the user has defined in the Registry with the Setnet32 utility
- Non-HCL OneDB environment variables retrieved from the C runtime environment variables
- Table of defined defaults for HCL OneDB environment variables
The ifx_getenv() function is not case sensitive. You can specify the name of the environment variable in any case.
The ifx_getenv() function operates only on the data structures accessible to the C runtime library and not on the environment segment that the operating system creates for the process. Therefore, programs that use ifx_getenv() might retrieve invalid information.
The ifx_putenv() and ifx_getenv() functions use the copy of the environment to which the global variable _environ points to access the environment.
char ONEDB_HOMEVal[100];
/* Get current value of ONEDB_HOME */
ONEDB_HOMEVal = ifx_getenv( "ONEDB_HOME" );
/* Check if ONEDB_HOME is set */
If( ONEDB_HOMEVal != NULL )
printf( "Current ONEDB_HOME value is %\n", ONEDB_HOMEVal );