Fortran READ(*,*), WRITE(*,*) arguments -
this question has been covered in previous questions. however, previous discussions seem incomplete.
fortran has several i/o statements. there read(*,*)
, write(*,*)
, etc. first asterisk (*) standard asterisk designating input or output keyboard to/from screen. question second asterisk:
the second asterisk designates format of i/o elements, data type being used. if asterisk left unchanged, fortran complier uses default format (whatever may be, based on compiler). users must use number of format descriptors designate data type, precision, , forth.
(1) these format descriptors universal fortran compilers , versions of fortran?
(2) can find standard list of these format descriptors? example, f8.3
means number should printed using fixed point notation field width 8 , 3 decimal places.
edit: reference edit descriptors can found here: http://fortranwiki.org/fortran/show/edit+descriptors
first, clarification, 1st asterisk in read/write statement has different meaning state. write, means write default file unit (in linux world standard out), read means read default file unit (in linux world standard in), either of may not connected terminal screen or keyboard.
the 2nd asterisk means use list directed io. read statements useful because don't need specified format input. breaks line fields separated space or comma (maybe couple others aren't commonly used), , reads each field in turn variable associated field in argument list, ignoring unread fields, , continuing onto next line if not enough fields read in (unless line termination character \
explicitly included).
for writes, means compiler allowed determine format write variables out (i believe no separator). believe allowed @ run time, guaranteed value trying write fit format specifier used, can assured won't *******
written out. down side have manually include separator character in argument list, or numbers run together.
in general, using list directed read more of convenience user, don't have fit inputs rigidly defined fields, , list directed writes convenience programmer, in case they're not sure output like.
Comments
Post a Comment