On 15/05/2018 07:22, Mudelsee M wrote:
> thanks for the reply. I agree that malformed files (i.e., others than file "a" I sent with my inquiry message) should be avoided, but that is life if you give courses and participants bring own data.
It seems to me that the problem you have is that sometimes what a human would call the last line of a file is not what all Fortran systems would call the last "record". This problem is exacerbated by differences between operating systems in what they assume as for end-of-line and end-of-file sequences.
The solution to this, I've found, is to abandon record-oriented I/O in favour of stream I/O. This will require some changes to the program but it means that you can read any file byte-by-byte, giving the programmer the power to overcome any defects in the assumed record structure.