INtime SDK Help
GetRtEnvironmentVariableByIndex
INtime SDK v7.1 > About INtime > INtime Kernel > Environment variables > GetRtEnvironmentVariableByIndex

Return an environment variable by its index.

BOOLEAN 
GetRtEnvironmentVariableByIndex(
    DWORD dwIndex, 
    LPSTR szValue, 
    LPDWORD pdwValueLen);

Parameters

dwIndex
Ordinal value for name/value pair. May be 0 through n - 1 where n is is the total number of environment variables.
szValue
Pointer to buffer to receive the value.
pdwValueLen
Pointer to variable containing the size of the buffer. After a successful call contains the number of characters in the returned value, excluding the trailing NULL.

Remarks

The call may be used for discovering all of the variables in the current process environment.

If the buffer supplied is too small for the value to be returned the call returns FALSE and sets the last error to E_LIMIT, and the value at pdwLocation to the number of characters which will be returned, excluding the trailing NULL.

Return value

Returns TRUE on success and the value of the requested variable is copied to the supplied buffer.

Returns FALSE on error. The status is returned by calling GetLastRtError(). Possible error conditions include:

E_EXIST
There is no variable corresponding to the given index.
E_LIMIT
The buffer supplied is too small for the value of the variable to be returned. See Remarks.
E_BAD_ADDR
One or other of the szValue or pdwValueLen pointers is invalid.

Requirements

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