GET_ENVIRONMENT_VARIABLE — Get an environmental variable#
- 
GET_ENVIRONMENT_VARIABLE(NAME, VALUE, LENGTH, STATUS, TRIM_NAME)#
- Get the - VALUEof the environmental variable- NAME.- Parameters:
- NAME – Shall be a scalar of type - CHARACTERand of default kind.
- VALUE – (Optional) Shall be a scalar of type - CHARACTERand of default kind.
- LENGTH – (Optional) Shall be a scalar of type - INTEGERand of default kind.
- STATUS – (Optional) Shall be a scalar of type - INTEGERand of default kind.
- TRIM_NAME – (Optional) Shall be a scalar of type - LOGICALand of default kind.
 
- Returns:
- Stores the value of - NAMEin- VALUE. If- VALUEis not large enough to hold the data, it is truncated. If- NAMEis not set,- VALUEwill be filled with blanks. Argument- LENGTHcontains the length needed for storing the environment variable- NAMEor zero if it is not present.- STATUSis -1 if- VALUEis present but too short for the environment variable; it is 1 if the environment variable does not exist and 2 if the processor does not support environment variables; in all other cases- STATUSis zero. If- TRIM_NAMEis present with the value- .FALSE., the trailing blanks in- NAMEare significant; otherwise they are not part of the environment variable name.
 - Standard:
- Fortran 2003 and later 
- Class:
- Subroutine 
- Syntax:
- CALL GET_ENVIRONMENT_VARIABLE(NAME[, VALUE, LENGTH, STATUS, TRIM_NAME) 
- Example:
- PROGRAM test_getenv CHARACTER(len=255) :: homedir CALL get_environment_variable("HOME", homedir) WRITE (*,*) TRIM(homedir) END PROGRAM