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!

How to treat data in multiple lines as one line?

Status
Not open for further replies.

wattakid

Technical User
Mar 1, 2006
2
US
My data is in lines of varying length. I need to read 'x' amounts of data, store it in an array, and then continue. The problem is the READ command then skips to the next line. Ignoring the remainder. I would like to continue adding the data on the line to the array, and only have Fortran go to the next line when there is no more data on the line.

Simply put, the data needs to be read sequentially 'x' times, as if all of the data was in one row. There is no specific pattern to the amount not read.

Thanks ahead for any help.
 
1) Read the line as a character array
2) Read the data out of the character array into a numeric array. You can use an arbitrary number like 100 for the maximum value of X and end= to jump out when you've reached the end of the character array.
3) At the end= label, the loop counter will tell you one more than the number of numbers you've read in.
 
Thank so much you xwb! It solved my problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top