redglitter
Programmer
Hey everyone!
I'm new to fortran and would like to get some help from you pros out there! It would really help a bunch.
Basically, my problem is that I have a .txt file, of unknown number of rows, which contains data in the following format:
**start**
equipment(a), value1, value2, value3, value4
equipment(b), value1, value2, value3, value4
equipment(c), value1, value2, value3, value4
.
.
.
End
**end**
I have no problems reading the data I need using the following code in a DO loop:
READ (1,*) equipment, a, b, c, d
However, I get an error when I want to terminate reading the .txt file. I'm currently using this syntax to exit:
IF (equipment=="END") EXIT
Are there any ways to terminate upon reading the "END" line? Your help is much appreciated! Thank you
I'm new to fortran and would like to get some help from you pros out there! It would really help a bunch.
Basically, my problem is that I have a .txt file, of unknown number of rows, which contains data in the following format:
**start**
equipment(a), value1, value2, value3, value4
equipment(b), value1, value2, value3, value4
equipment(c), value1, value2, value3, value4
.
.
.
End
**end**
I have no problems reading the data I need using the following code in a DO loop:
READ (1,*) equipment, a, b, c, d
However, I get an error when I want to terminate reading the .txt file. I'm currently using this syntax to exit:
IF (equipment=="END") EXIT
Are there any ways to terminate upon reading the "END" line? Your help is much appreciated! Thank you