Clicky
Showing changes from revision #2 to #3:
(追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)
Retrieve the entire command line that was used to invoke the program.
Fortran 2003 and later
Subroutine
call get_command(command)
call get_command([command, length, status])
(追記ここまで)
command
-character
and of default kind.length
- (Optional) Shall be of type integer
and of default kind.status
- (Optional) Shall be of type integer
and of default kind.(削除) Stores (削除ここまで)(追記) If (追記ここまで)(削除) the (削除ここまで)(削除) entire (削除ここまで)(削除) command (削除ここまで)(削除) line (削除ここまで)(削除) that (削除ここまで)(削除) was (削除ここまで)(削除) used (削除ここまで)(削除) to (削除ここまで)(削除) invoke (削除ここまで)(削除) the (削除ここまで)(削除) program (削除ここまで)(削除) in (削除ここまで)command
(削除) . (削除ここまで)(追記) (追記ここまで)(削除) If (削除ここまで)(追記) is (追記ここまで)(追記) present, (追記ここまで)(追記) stores (追記ここまで)(追記) the (追記ここまで)(追記) entire (追記ここまで)(追記) command (追記ここまで)(追記) line (追記ここまで)(追記) that (追記ここまで)(追記) was (追記ここまで)(追記) used (追記ここまで)(追記) to (追記ここまで)(追記) invoke (追記ここまで)(追記) the (追記ここまで)(追記) program (追記ここまで)(追記) in (追記ここまで)command
(削除) (削除ここまで)(追記) . (追記ここまで)(削除) is (削除ここまで)(追記) If (追記ここまで)(削除) not (削除ここまで)(削除) large (削除ここまで)(削除) enough, (削除ここまで)(削除) the (削除ここまで)(削除) command (削除ここまで)(削除) will (削除ここまで)(削除) be (削除ここまで)(削除) truncated. (削除ここまで)(追記) length
(追記ここまで)(追記) is present, it is assigned the length of the command line. If (追記ここまで)(追記) status
(追記ここまで)(追記) is present, it is assigned 0 upon success of the command, -1 if (追記ここまで)(追記) command
(追記ここまで)(追記) is too short to store the command line, or a positive value in case of an error. (追記ここまで)
program test_get_command
character(len=255) :: cmd
call get_command(cmd)
write (*,*) trim(cmd)
end program
get_command_argument, command_argument_count