I've been looking on the net but I haven't found any solution yet.
I'm trying to read from a .neu (neutral format) file, which is a type of file generated by the Gambit software, and contains information about a mesh used in CFD calculations.
The file goes like this:
CONTROL INFO 2.4.6
** GAMBIT NEUTRAL FILE
S1
PROGRAM: Gambit VERSION: 2.4.6
NUMNP NELEM NGRPS NBSETS NDFCD NDFVL
120847 240234 1 1 2 2
ENDOFSECTION
NODAL COORDINATES 2.4.6
1 0.00000000000e+000 2.50000000000e+001
2 0.00000000000e+000 0.00000000000e+000
3 0.00000000000e+000 2.49000000000e+001
4 0.00000000000e+000 2.48000000000e+001
...
I'm trying to read the following line:
120847 240234 1 1 2 2
Here's my code:
PROGRAM readGAMBIT
INTEGER, DIMENSION(6) :: mdata
LOGICAL :: lexist
INTEGER :: i
INQUIRE (FILE="mesh.neu", EXIST=lexist)
IF (.not.lexist) THEN
STOP "**** mesh.neu does not exist ****"
ENDIF
OPEN(77,file="mesh.neu")
DO i = 1, 6
READ(1,*) ! Ignores the 1st 6 lines
ENDDO
READ(1,*) mdata(1), mdata(2), mdata(3), mdata(4), mdata(5), mdata(6)
PRINT*, mdata(1)
CLOSE(77)
END PROGRAM readGAMBIT
However, when I run this code I get "Fortran runtime error: End of file" . The file only ends after a couple thousand lines however.
What am I doing wrong? Why is the program thinking that the file only ends at the first line?