Stream access (Fortran 2003)
- Some file storage units represent record markers.
- The record structure is inferred from the record markers stored in the file.
- There is no theoretical limit on record length.
- Writing an empty record without a record marker has no effect.
- If there is no record marker at the end of a file, the final record is incomplete but not empty.
- The endfile record in a file previously connected for sequential access is not considered part of the file when you connect that file for stream access.
The first file storage unit of a file connected for formatted stream access has a position of 1. The position of each subsequent storage unit is greater than the storage unit immediately before it. The positions of successive storage units are not always consecutive and positionable files need not be read or written to in order of position. To determine the position of a file storage unit connected for formatted stream access, use the POS= specifier of the INQUIRE statement. If the file can be positioned, you can use the value obtained using the INQUIRE statement to position that file. You read from the file while connected to the file, as long as the storage unit has been written to since file creation and that the connection permits a READ statement. File storage units of a file connected for formatted stream access can only be read or written by formatted stream access input/output statements.
The first file storage unit of a file connected for unformatted stream access has a position of 1. The position value of successive storage units is incrementally one greater than the storage unit it follows. Positionable files need not be read or written to in order of position. Any storage unit can be read from the file while connected to the file, if the storage unit has been written to since file creation and that the connection permits a READ statement. File storage units of a file connected for unformatted stream access can only be read or written by stream access input/output statements.