Next: , Previous: GETCWD, Up: Intrinsic Procedures


6.89 GETENV — Get an environmental variable

Description:
Get the VALUE of the environmental variable ENVVAR.

This intrinsic routine is provided for backwards compatibility with GNU Fortran 77. In new code, programmers should consider the use of the GET_ENVIRONMENT_VARIABLE intrinsic defined by the Fortran 2003 standard.

Standard:
GNU extension
Class:
Subroutine
Syntax:
CALL GETENV(ENVVAR, VALUE)
Arguments:

ENVVAR Shall be of type CHARACTER(*).
VALUE Shall be of type CHARACTER(*).

Return value:
Stores the value of ENVVAR in VALUE. If VALUE is not large enough to hold the data, it is truncated. If ENVVAR is not set, VALUE will be filled with blanks.
Example:
          PROGRAM test_getenv
            CHARACTER(len=255) :: homedir
            CALL getenv("HOME", homedir)
            WRITE (*,*) TRIM(homedir)
          END PROGRAM
     

See also:
GET_ENVIRONMENT_VARIABLE