- #1
jelanier
- 67
- 1
I wrote a simple FORTRAN program to show my read problem. This works fine in windows. On the Linux machine I always get this eof error when I open a file and read. This means that every program I have written doesn't work :) The error is line 12 EOF. What is the problem? (I am using GFORTRAN in linux)
program read_write
implicit none
!reads data from a file called input.dat
integer :: i
real a(10) !single dimension array
real b(10)
open(10,file='input.dat')
do i = 1,10
read(10,*) a(i) !this is line 12
b(i) = a(i)**1.3
end do
close(10)
open(12,file='output.dat')
do i = 1,10
write (12,*) a(i),b(i)
end do
close(12)
end program read_write
oh, the input file is simply:
1
2
3
4
5
6
7
8
9
10
Thanks,
Jim
program read_write
implicit none
!reads data from a file called input.dat
integer :: i
real a(10) !single dimension array
real b(10)
open(10,file='input.dat')
do i = 1,10
read(10,*) a(i) !this is line 12
b(i) = a(i)**1.3
end do
close(10)
open(12,file='output.dat')
do i = 1,10
write (12,*) a(i),b(i)
end do
close(12)
end program read_write
oh, the input file is simply:
1
2
3
4
5
6
7
8
9
10
Thanks,
Jim