Clicky
Showing changes from revision #2 to #3:
(追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)
Get the value
of the environmental variable name
.
Note 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.
Fortran 2003 and later
Subroutine
call get_environment_variable(name[, value, length, status, trim_name)
call get_environment_variable(name[, value, length, status, trim_name)
(追記ここまで)
name
-(追記) (Optional) (追記ここまで) Shall be a scalar of type(削除) character(1) (削除ここまで)(追記) character (追記ここまで)
value
-(追記) (Optional) (追記ここまで) Shall be a scalar of type(削除) character(1) (削除ここまで)(追記) character (追記ここまで)
length
-(追記) (Optional) (追記ここまで) Shall be a scalar of type(削除) integer(4) (削除ここまで)(追記) integer (追記ここまで)
status
-(追記) (Optional) (追記ここまで) Shall be a scalar of type(削除) integer(4) (削除ここまで)(追記) integer (追記ここまで)
trim_name
-(追記) (Optional) (追記ここまで) Shall be a scalar of type(削除) logical(4) (削除ここまで)(追記) logical (追記ここまで)
Stores the value of name
in value
. If value
is not large enough to hold the data, it is truncated. If name
is not set, value
will be filled with blanks. Argument length
contains the length needed for storing the environment variable name
or zero if it is not present. status
is -1 if value
is 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 status
is zero. If trim_name
is present with the value .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" (削除ここまで)(追記) "HOME" (追記ここまで), homedir)
write (*,*) trim(homedir)
end program