Reads from standard input.
Syntax
The syntax of the ACCEPT
statement can take one of two forms:
Formatted and list-directed syntax:
ACCEPT format [, input-list ] |
Namelist-directed syntax:
- format
is one of the following:
An asterisk (*),
specifying list-directed I/O.
The label of a FORMAT
statement containing the format specification.
An integer variable that has been assigned the label
of a FORMAT statement.
An embedded format specification.
- input-list
is a comma-separated list of data items. The data
items can include variables and implied-DO
lists.
- name
is the name of a namelist group, as previously defined
by a NAMELIST
statement. Using this syntax, the ACCEPT
statement accepts data from standard input and transfers it to the
namelist group. To perform namelist-directed I/O with a
connected file, you must use the READ
statement and include the NML=
specifier.
Description
The ACCEPT
statement is an HP Fortran 90 extension and is provided for compatibility
with other versions of Fortran. The standard READ
statement performs the same function, and standard-conforming programs
should use it.
The ACCEPT
statement transfers data from standard input to internal storage.
(Unit 5 is preconnected to the HP-UX standard input.) The ACCEPT
statement can be used to perform formatted, list-directed, and namelist-directed
I/O only.
To read data from a connected file, use the READ
statement.
Examples
The following example of the ACCEPT
statement reads an integer and a floating-point value from standard
input, using list-directed formatting:
INTEGER :: i REAL :: x ACCEPT *, i, x |
Related statements
FORMAT,
NAMELIST, PRINT
and READ
Related concepts
For related information, see the following: