Reputation: 9
I wanted to open two files in Fortran, but get the following error message:
Fortran Runtime Error: End of line
infile_T contains years from 1970 to 2100 and temperature values for these years. Infile_CO2 contains years for the same time period and CO2-values. I only want to load in the years and temperature values from 1970 to 1998.
Here is my code:
integer j,p, Jahre_CO2
character*20 infile_T, infile_CO2
parameter(infile_T='temp2m.obs',
1 infile_CO2='yco2.sze',
1 anfja=0,
1 endja=29,
1 nt=endja-anfja+1)
real T_beob(anfja:endja),Jahre_T, CO2_beob(anfja:endja)
open(11,file=infile_T)
do ja=anfja,endja
read(11,*) Jahre_T,T_beob(ja)
enddo
close(11)
print *,Jahre_T
open(12, file=infile_CO2)
do p=anfja,endja
read(12,*) Jahre_CO2,CO2_beob(p)
enddo
close(12)
write(6,*) 'Daten eingelesen !',T_beob
Upvotes: -2
Views: 184
Reputation: 19
Make sure your files contain all the data you expect them to contain. If your files contain 130 lines and you're only reading in 30, you shouldn't receive an end of file error.
Check the format of the data. Usually 'years' (Jahre) are integers ; so you have Jahre_CO2 as integer, but Jahre_T as real -- double check this.
Upvotes: 0