Fortran input and output are performed on logical units.
A unit is
- a non-negative INTEGER associated with a physical device such as a disk file, the
console, or a printer. The unit must be connected to a file or device in an OPEN
statement, except in the case of pre-connected files.
- an asterisk, `*', indicating the standard input and standard output devices, usually
the keyboard and monitor, that are preconnected.
- a CHARACTER variable corresponding to the name of an internal file.
Fortran statements are available to connect (OPEN)
or disconnect (CLOSE) files and devices from input/output
units; transfer data (PRINT,
READ, WRITE); establish the position within
a file (REWIND, BACKSPACE,
ENDFILE); and inquire about a file or device
or its connection (INQUIRE).
In the following sections, these topics are described:
- Preconnected Units describes the standard
in, standard out and standard error units.
- Files describes file I/O concepts and the
types of files supported by Fortran 95.
- Carriage Control covers the legacy aspects
of controlling output using Fortran carriage control commands.
- Input/Output Editing describes the formatting
of data both for input and output.