The system utility gEnqSysEnviron() can be used to enquire the setting of a system environment variable. The environment variable name is passed in through the string envnam, and its setting, if any, is returned in setting. If there is no setting of the requested environment variable, a NULL/blank string is returned.
The C/C++ binding returns the environment setting either in the string setting of length slen or (if setting is NULL) as a pointer to a character string that has been malloc'ed internally and which should be freed after use with the function free. In the Fortran 90 binding the environment setting is returned in the character argument setting. If this is not large enough to contain the setting it will be truncated.