GET_ENVIRONMENT_VARIABLE — Get an environmental variableNote that GET_ENVIRONMENT_VARIABLE need not be thread-safe. It is the responsibility of the user to ensure that the environment is not being updated concurrently with a call to the GET_ENVIRONMENT_VARIABLE intrinsic.
CALL GET_ENVIRONMENT_VARIABLE(NAME[, VALUE, LENGTH, STATUS, TRIM_NAME) | NAME | Shall be a scalar of type CHARACTER and of default kind. |
| VALUE | (Optional) Shall be a scalar of type CHARACTER and of default kind. |
| LENGTH | (Optional) Shall be a scalar of type INTEGER and of default kind. |
| STATUS | (Optional) Shall be a scalar of type INTEGER and of default kind. |
| TRIM_NAME | (Optional) Shall be a scalar of type LOGICAL and of default kind. |
.FALSE., the trailing blanks in NAME are significant; otherwise they are not part of the environment variable name. PROGRAM test_getenv
CHARACTER(len=255) :: homedir
CALL get_environment_variable("HOME", homedir)
WRITE (*,*) TRIM(homedir)
END PROGRAM
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gfortran/GET_005fENVIRONMENT_005fVARIABLE.html