The file read function has two parameters
read( unit=unit-no, fmt=format-label ) [ list of arguments ]Each parameter can be replaced by a , with the meaning ``default unit'' or ``default format''. We will talk later about formats.
The call
read(5,*) R, Vreads two reals from unit number 5 in default format. Unit is predefined, and is the standard input (keyboard, unless redirected). Thus, an equivalent formulation is
read(*,*) R, V
The file write function is very similar,
write( unit\_no, format label ) [ list of arguments ]Each parameter can be replaced by a (defaults). The call
write(6,*) R, Vwrites two reals onto unit number 6 in default format. Unit is predefined, and is the standard output (monitor, unless redirected). Thus, an equivalent formulation is
write(*,*) R, VThe list of arguments must be of standard intrinsic types (unless explicit format is used). Each READ statement reads the arguments from a new line; non-advancing READ is possible, but we need to use formats.