I understand that when reading data from a file, Fortran will skip lines beginning with and an asterisk (*), assuming that they are a comment. Well, it looks like I'm having a problem achieving this behavior with the very simple program I created. This is my simple Fortran program:
1 program test
2
3 integer dat1
4
5 open(unit=1,file="file.inp")
6
7 read(1,*) dat1
8
9
10 end program test
This is the file.inp file:
1 *Hello
2 1
I built my simple program with
gfortran -g -o test test.f90
When I run, I get an error message:
At line 7 of file test.f90 (unit = 1, file = 'file.inp')
Fortran runtime error: Bad integer for item 1 in list input
When I run the input file with the comment line deleted, that is:
1 1
The code is working fine. So the problem seems to be that Fortran correctly interprets this comment line. It should be something extremely simple, I'm missing here, but I can't add anything to Google.