Reputation: 37
I have an simple input file with comments (lines starting with #) in it. Sample data looks like:
#NDIM
1
#NX NY NZ
3001 1 1
#I_RXN
2
I would like to tell the code that every time I encounter the character # at the start of the line to skip that line and to move on to the next line. I have to do this in FORTRAN 77.
Upvotes: 0
Views: 1480
Reputation: 29381
You can read the lines into a string then test whether the first character is "#". If not, use an "internal read" to read the numerical values from the string. There have been previous answers about this technique, e.g., Reading comment lines correctly in an input file using Fortran 90
Upvotes: 4