informix
INFORMIX-ESQL/C Programmer's Manual
ESQL/C Function Library

ifx_getenv()

Purpose

The ifx_getenv() function retrieves the value of a current environment variable.

Syntax

Usage

The ifx_getenv() function searches for the environment variable in the following order:

  1. Table of Informix environment variables that the application has modified or defined with the ifx_putenv() function or directly (the InetLogin structure)
  2. Table of Informix environment variables that the user has defined in the Registry with the Setnet32 utility
  3. Non-Informix environment variables retrieved from the C runtime environment variables
  4. Table of defined defaults for Informix 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.

The following program fragment uses ifx_getenv() to retrieve the current value of the INFORMIXDIR environment variable:

Return Codes

The ifx_getenv() function returns a pointer to the Informix environment table entry that contains varname, or returns NULL if the function does not find varname in the table.

Warning: Do not use the returned pointer to modify the value of the environment variable. Use the ifx_putenv() function instead. If ifx_getenv() does not find "varname" in the Informix environment table, the return value is NULL.


INFORMIX-ESQL/C Programmer's Manual, Version 9.21
Copyright © 1999, Informix Software, Inc. All rights reserved