%GETENV

%GETENV


%FSIZE Index Level %GETHOSTID
Syntax pointer = (char*)%GETENV( name )
Category BASIC
Type C Function
Description searches the environment for a string of the form "name=value" and returns a pointer to "value" in the current environment if such a string is present, otherwise, a NULL is returned.
Options
See Also %PUTENV CFUNCTION c function env environ
Example * Get the Unix name of our terminal: eg TERM=wy50
pointer=(char*)%getenv( 'TERM' )
if pointer=0 then
 crt 'Unix TERM is not defined'
end else
 * We got a C pointer to the 'name'. Copy it into Pick
 * BASIC variable
 char pickterm[32]
 %strcpy( pickterm, (char*)p )
 pickterm=field(pickterm,char(0),1)
end
Warnings The pointer returned points to the environment space. It is not a static area and may change.
Compatibility D3/Unix
%FSIZE Index Level %GETHOSTID