Skip to main content

7.4) All On One Line


However, if your data are stored in input.dat on one line as:

3.4   5.7   6.8         

Now there is a big difference in the way the data is stored since it is on one line now. The following will read the values without any problem:

open(22,file=’input.dat’)
read(22,*) a, b, c

The read statement will search the data file and assign the values and if they happen to all be on the same line that is acceptable to the program.

Important: if you put more than one data on a line then separate values with a space rather than a comma.