NEWUNIT=
specifier has been added to the OPEN
statement; this
allocates a new unit number that cannot clash with any other logical unit (the
unit number will be a special negative value).
For example,
INTEGER unit OPEN(FILE='output.log',FORM='FORMATTED',NEWUNIT=unit) WRITE(unit,*) 'Logfile opened.'The
NEWUNIT=
specifier can only be used if either the FILE=
specifier is also used, or if the STATUS=
specifier is used with the
value 'SCRATCH'
.
Write (*,Output_Unit) f(100)the function
f
is permitted to perform i/o on any unit except
Output_Unit
; for example, if the value 100 is out of range, it would be
allowed to produce an error message with
Write (*,Error_Unit) 'Error in F:',n,'is out of range'
*
) as its repeat count. For example,
SUBROUTINE s(x) LOGICAL x(:) PRINT 1,x 1 FORMAT('x =',*(:,' ',L1)) END SUBROUTINEwill display the entire array
x
on a single line, no matter how many
elements x
has.
An indefinite repeat count is only allowed at the top level of the format
specification, and must be the last format item.
G0
and G0.
d edit descriptors perform generalised
editing with all leading and trailing blanks (except those within a character
value itself) omitted.
For example,
PRINT 1,1.25,.True.,"Hi !",123456789 1 FORMAT(*(G0,','))produces the output
1.250000,T,Hi !,123456789,
[7.2] Note that G0.
d was not permitted by Fortran 2008 to be used for output of types
Integer, Logical, or Character data, but this limitation has been removed by Fortran 2018.