]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
1 | .. |
2 | Copyright 1988-2022 Free Software Foundation, Inc. | |
3 | This is part of the GCC manual. | |
4 | For copying conditions, see the copyright.rst file. | |
5 | ||
6 | .. _command_argument_count: | |
7 | ||
8 | COMMAND_ARGUMENT_COUNT --- Get number of command line arguments | |
9 | *************************************************************** | |
10 | ||
11 | .. index:: COMMAND_ARGUMENT_COUNT, command-line arguments, command-line arguments, number of, arguments, to program | |
12 | ||
13 | .. function:: COMMAND_ARGUMENT_COUNT() | |
14 | ||
15 | ``COMMAND_ARGUMENT_COUNT`` returns the number of arguments passed on the | |
16 | command line when the containing program was invoked. | |
17 | ||
18 | :return: | |
19 | The return value is an ``INTEGER`` of default kind. | |
20 | ||
21 | Standard: | |
22 | Fortran 2003 and later | |
23 | ||
24 | Class: | |
25 | Inquiry function | |
26 | ||
27 | Syntax: | |
28 | .. code-block:: fortran | |
29 | ||
30 | RESULT = COMMAND_ARGUMENT_COUNT() | |
31 | ||
32 | Example: | |
33 | .. code-block:: fortran | |
34 | ||
35 | program test_command_argument_count | |
36 | integer :: count | |
37 | count = command_argument_count() | |
38 | print *, count | |
39 | end program test_command_argument_count | |
40 | ||
41 | See also: | |
42 | :ref:`GET_COMMAND`, | |
3ed1b4ce | 43 | :ref:`GET_COMMAND_ARGUMENT` |