Next: Legacy PARAMETER statements, Previous: Bitwise logical operators, Up: Extensions implemented in GNU Fortran [Contents][Index]
6.1.32 Extended I/O specifiers
GNU Fortran supports the additional legacy I/O specifiers
CARRIAGECONTROL, READONLY, and SHARE with the
compile flag -fdec, for compatibility.
CARRIAGECONTROLThe
CARRIAGECONTROLspecifier allows a user to control line termination settings between output records for an I/O unit. The specifier has no meaning for readonly files. WhenCARRAIGECONTROLis specified upon opening a unit for formatted writing, the exactCARRIAGECONTROLsetting determines what characters to write between output records. The syntax is:OPEN(..., CARRIAGECONTROL=cc)
Where cc is a character expression that evaluates to one of the following values:
'LIST'One line feed between records (default) 'FORTRAN'Legacy interpretation of the first character (see below) 'NONE'No separator between records With
CARRIAGECONTROL='FORTRAN', when a record is written, the first character of the input record is not written, and instead determines the output record separator as follows:Leading character Meaning Output separating character(s) '+'Overprinting Carriage return only '-'New line Line feed and carriage return '0'Skip line Two line feeds and carriage return '1'New page Form feed and carriage return '$'Prompting Line feed (no carriage return) CHAR(0)Overprinting (no advance) None READONLYThe
READONLYspecifier may be given upon opening a unit, and is equivalent to specifyingACTION='READ', except that the file may not be deleted on close (i.e.CLOSEwithSTATUS="DELETE"). The syntax is:OPEN(..., READONLY)SHAREThe
SHAREspecifier allows system-level locking on a unit upon opening it for controlled access from multiple processes/threads. TheSHAREspecifier has several forms:OPEN(..., SHARE=sh) OPEN(..., SHARED) OPEN(..., NOSHARED)
Where sh in the first form is a character expression that evaluates to a value as seen in the table below. The latter two forms are aliases for particular values of sh:
Explicit form Short form Meaning SHARE='DENYRW'NOSHAREDExclusive (write) lock SHARE='DENYNONE'SHAREDShared (read) lock In general only one process may hold an exclusive (write) lock for a given file at a time, whereas many processes may hold shared (read) locks for the same file.
The behavior of locking may vary with your operating system. On POSIX systems, locking is implemented with
fcntl. Consult your corresponding operating system’s manual pages for further details. Locking viaSHARE=is not supported on other systems.
Next: Legacy PARAMETER statements, Previous: Bitwise logical operators, Up: Extensions implemented in GNU Fortran [Contents][Index]
