Returns the argument number i of the command line.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | i | |||
| integer, | intent(out) | :: | status |
function read_argument(i, status) integer, intent(in) :: i integer, intent(out) :: status character(:), allocatable :: read_argument, arg integer :: length ! We allocate the string with the needed length before reading it: call get_command_argument(i, length=length) allocate(character(length) :: arg) call get_command_argument(i, value=arg, status=status) read_argument = arg end function read_argument