150. Connect INPUT_UNIT and OUTPUT_UNIT to files to redirect standard input and output.#

topic: Input and Output

Note

This tip is a draft1.

Module ISO_FORTRAN_ENV has named constants INPUT_UNIT and OUTPUT_UNIT, usually 5 and 6. Connecting output_unit to a file sends the output of PRINT fmt, and WRITE (,fmt) to that file. Connecting input_unit to a file causes READ (,fmt) to access that file



1

From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.