I'm just learning Fortran and I haven't been able to solve this simple problem after searching through various Fortran books. I have a file called test1.txt with the following data:
I'm just playing with commands and all I want to do is read ALL of the data into two arrays and then work with the data. The problem is, it doesn't read the last line for me. Here is the test code:
real sum, time, temp, ave
5 read (10,*,END=15) time, temp
go to 5
15 if (count.EQ.0) then
print*, 'no data according to record count'
print 25, count, ave
25 format(1x,'count=',I3,5X,'average=',F8.2,'degrees f')
And the output looks like this:
count = 9 average = 30.00 degrees f
You'll notice that it should say count=9 and average = 27.78
I've tried the three most common ways of input from a file like using a do loop if I know exactly how many values are in the file, using a trailer signal by placing something like 999 at the end of the file, and using the END statement like in my code currently. All of them produced the same results.
I'm using Visual Fortran 5.0 with Fortran 90
your code here
your text hereyour text hereyour text here