Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read numbers

Status
Not open for further replies.

TheKKK

Technical User
Mar 21, 2009
10
GR
I would like to read separate each number from a file that looks like this:

100. .0000 2 565.4 328.65 35.97 30.71 NO
200. .7663E-03 2 565.4 328.65 67.62 59.54 NO
1000. 93.37 2 565.4 328.65 278.23 345.64 NO

I use:
Code:
myfmt = "(1X,F7.0,2X,G10.4,4X,I1,4X,4(1X,F7.2),4X,A2)"

READ(UNIT=80,myfmt)a,a,b,a,a,a,a,a,a,word
The problem is that I cant control the spaces between the numbers so i dont know how many 1X i should put and if i read a line as a string i cant take one number out of it.
Can anyone suggest me something?


 
Try an unformatted read

Code:
READ(UNIT=80,*)a,a,b,a,a,a,a,a,a,word
As long as they are space delimited and the word does not contain spaces, you won't have a problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top