IS_IOSTAT_END(I) (Fortran 2003)

Purpose

Checks for an end-of-file condition.

Class

Elemental function

Argument type and attributes

I
must be of type integer.

Result type and attributes

Default logical scalar.

Result value

Returns .TRUE. if the argument matches the value of the IOSTAT= specifier when an end-of-file condition has occurred. Otherwise, IS_IOSTAT_END returns .FALSE..

Examples

The following is an example of IS_IOSTAT_END:

program a
  integer :: ios = 0, x

  open( 1, file='dat.dat', action='read' )

  do while( .not. is_iostat_end(ios) )

      read( 1,*,iostat=ios ) x
      write(6,*) "ios = ", ios
      write(6,*) "x = ", x

   enddo
end program a