next up previous contents
Next: OPEN Up: File I/O Previous: File I/O   Contents

Records and Files

A record is a sequence of characters and values; a sequence of records form a file. You can think of a file as a typed page, with the records being the lines of text.

A file can have sequential access (records are read one after the other) or random access (any record, specified by its number, can be accessed any time). The last record in a file is of special type, called the endfile record (it allows the automatic detection of the end of the file during reading).

In this part we talk about external files, stored on external medium - like the hard disk.

A program can read or write formatted or unformatted records.

Formatted records

The following statement writes one formatted record; the format is explicitly given (F7.3)

write (unit=10, fmt="f7.3") r1
Unformatted records

The following statement writes one unformatted record; no format is given

write (unit=10) r1
Unformatted data can be retrieved by unformatted read; the following statement reads one record; again, no format is specified.
read (unit=10) x1
Note that unformatted files may not be portable from one system to another.


next up previous contents
Next: OPEN Up: File I/O Previous: File I/O   Contents
Adrian Sandu 2001-08-26