next up previous contents
Next: Example: READ Character Data Up: Formats Previous: Editor Descriptors   Contents

Example: READ Integer Data

Consider a read statement that initializes three INTEGER variables, i, j and k. The input string is

123456789
Depending on the format, the string can be interpreted differently; below are several examples of editor lists, and the resulting values of the variables i, j and k.

Statement i j k
READ "(I2,I3,I4)",i,j,k 12 345 6789
READ "(I2,2X,I2,2X,I2)",i,j,k 12 56 9
READ "(I2,I3,T1,I4)",i,j,k 12 345 1234
READ "(I2,TR2,I3,TL3,I4)",i,j,k 12 567 5678

Note that Tw moves the input stream pointer to the w position of the current record/ current input line; TLw and TRw move the input stream pointer w positions to the left and right, respectively, inside the current record/ current input line.


next up previous contents
Next: Example: READ Character Data Up: Formats Previous: Editor Descriptors   Contents
Adrian Sandu 2001-08-26