SuivantPrec.Bas prec.BasNiv. sup.

Chapitre 10 Input/Output Facilities 

The I/O system of Fortran is relatively powerful, flexible, and well-defined. Programs can be portable and device-independent even if they make extensive use of input/output facilities: this is difficult if not impossible in many other high-level languages. The effects of the hardware and operating system cannot, of course, be ignored entirely but they usually only affect fairly minor matters such as the forms of file-name and the maximum record length that can be used.

The READ and WRITE statements are most common and generally look like this:
        READ(UNIT=*, FMT=*) NUMBER
        WRITE(UNIT=13, ERR=999) NUMBER, ARRAY(1), ARRAY(N)
The pair of parentheses after the word READ or WRITE encloses the control-list: a list of items which specifies where and how the data transfer takes place. The items in this list are usually specified with keywords. The list of data items to be read or written follow the control-list.

Other input/output statements have a similar form except that they only have a control-list. There are the file-handling statements OPEN, CLOSE, and INQUIRE, as well as the REWIND and BACKSPACE statements which alter the currently active position within a file.

Before covering the these statements in detail, it is necessary to explain some of the concepts and terminology involved.


   10.1 Files, I/O Units, and Records
   10.2 External Files
   10.3 Internal Files
   10.4 Pre-Connected Files
   10.5 Error and End-Of-File Conditions
   10.6 Format Specifications
   10.7 Format Edit Descriptors
   10.8 Format Data Descriptors A, E, F, G, I, L
   10.9 Format Control Descriptors
   10.10 List-Directed Formatting
   10.11 Carriage-Control and Printing
   10.12 Input/Output Statements and Keywords
   10.13 OPEN Statement
   10.14 CLOSE Statement
   10.15 INQUIRE Statement
   10.16 READ and WRITE Statements
   10.17 REWIND and BACKSPACE Statements

SuivantPrec.Bas prec.HautNiv. sup.