List-directed output provides a quick and easy way to print output without fussing with format details. If you need exact formats, use formatted I/O. A suitable format is chosen for each item, and where a conflict exists between complete accuracy and simple output form, the simple form is chosen.
Note these rules for list-directed output:
In general, each record starts with a blank space. For a print file, that blank is not printed. See "Printing Files" for details. @
Character strings are printed as is. They are not enclosed in quotes, so only certain forms of strings can be read back using list-directed input. These forms are described in the next section.
A number with no exact binary representation is rounded off.
Example: No exact binary representation:
demo% cat lis5.f READ ( 5, * ) X WRITE( 6, * ) X, ' beauty' WRITE( 6, 1 ) X 1 FORMAT( 1X, F13.8, ' truth' ) END demo% f77 lis5.f lis5.f: MAIN: demo% a.out 1.4 1.40000000 beauty 1.39999998 truth demo%
In the above example, if you need accuracy, specify the format.
Also note:
Output lines longer than 80 characters are avoided where possible.
Complex and double complex values include an appropriate comma.
Real, double, and quadruple precision values are formatted differently.
A backslash-n (\n) in a character string is output as a carriage return, unless the -xl option is on, and then it is output as a backslash-n(\n).
Example: List-directed I/O and backslash-n, with and without -xl:
demo% cat f77 bslash.f CHARACTER S*8 / '12\n3' / PRINT *, S END demo%
Without -xl, \n prints as a carriage return:
demo% f77 -silent bslash.f demo% a.out 12 3 demo%
With -xl, \n prints as a character string:
demo% f77 -xl -silent bslash.f demo% a.out 12\n3 demo%
Type |
Format |
---|---|
BYTE CHARACTER*n COMPLEX COMPLEX*16 COMPLEX*32 INTEGER*2 INTEGER*4 INTEGER*8 LOGICAL*1 LOGICAL*2 LOGICAL*4 LOGICAL*8 REAL REAL*8 REAL*16 |
Two blanks followed by the number An {n = length of character expression} '¤¤(', 1PE14.5E2, ',', 1PE14.5E2, ')' '¤¤(', 1PE22.13.E2, ',', 1PE22.13.E2, ')' '¤¤(', 1PE44.34E3, ',', 1PE44.34E3, ')' Two blanks followed by the number Two blanks followed by the number Two blanks followed by the number Two blanks followed by the number L3 L3 L3 1PE14.5E2 1PE22.13.E2 1PE44.34E4 |
COMPLEX*32 and REAL*16 are SPARC only.