Search code examples
fortran

Reading from file at eof


When reading from a file using the following command, and get iostat value to be eof, is the data from s valid or should I discard it?

Read (u, "(a)", iostat=st)  s

Solution

  • Upon an end of file condition for a READ statement, all variables in the input list become undefined. See F2008 9.11.3 item (3).