Fortran Wiki
get_command (changes)

Showing changes from revision #2 to #3: Added | Removed | Changed

Description

Retrieve the entire command line that was used to invoke the program.

Standard

Fortran 2003 and later

Class

Subroutine

Syntax

call get_command(command)

call get_command([command, length, status])

Arguments

  • command - Shall (Optional) shall be of typecharacter 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.

Return value

Stores If the entire command line that was used to invoke the program incommand . If is present, stores the entire command line that was used to invoke the program incommand . 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.

Example

program test_get_command
  character(len=255) :: cmd
  call get_command(cmd)
  write (*,*) trim(cmd)
end program

See also

get_command_argument, command_argument_count

category: intrinsics