next up previous contents
Next: FORMAT Statement / FMT= Up: Input / Output Previous: READ Statement

 

WRITE Statement

READ and WRITE can be interchanged in the following, (not all the specifiers can be used at the same time,)

 
WRITE([UNIT=]< unit >, [FMT=]< format >, IOSTAT=< int-variable >, ERR=< label >, &

ADVANCE=< advance-mode >, REC=< int-expr >) < output-list >

where Consider,
    WRITE(17,FMT='(I4)',IOSTAT=istat,ERR=10, END=11,EOR=12) ival
here, '(I4)' means INTEGER with 4 digits. the labels 10, 11 and 12 are statements where control can jump on an I / O exception. ival is an INTEGER variable whose value is written out.

    WRITE(*,'(A)',ADVANCE='NO') 'Input : '

Since non-advancing output has been specified, the cursor will remain on the same line as the string 'Input : ', under normal circumstances (default advancing output) the cursor would be positioned at the start of the next line. Note the explicit format descriptor.

See later for a more detailed explanation of the format edit descriptors. Return to corresponding overview page gif


next up previous contents
Next: FORMAT Statement / FMT= Up: Input / Output Previous: READ Statement

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.