IS_IOSTAT_EOR(3) - [STATE:INQUIRY] Test for end-of-record value
result = is_iostat_eor(i)
elemental integer function is_iostat_eor(i)integer(kind=KIND),intent(in) :: i
o I is integer of any kind o the return value is a default logical
IS_IOSTAT_EOR(3) tests whether a variable has the value of the I/O status "end of record". The function is equivalent to comparing the variable with the IOSTAT_EOR parameter of the intrinsic module ISO_FORTRAN_ENV.
o I : The value to test as indicating "end of record".
Returns .true. if and only if I has the value which indicates an end-of-record condition for iostat= specifiers, and is .false. otherwise.
Sample program:
program demo_is_iostat_eor use iso_fortran_env, only : iostat_eor implicit none integer :: inums(5), lun, iosResults:! create a test file to read from open(newunit=lun, form=formatted,status=scratch) write(lun, (a)) 10 20 30 write(lun, (a)) 40 50 60 70 write(lun, (a)) 80 90 write(lun, (a)) 100 rewind(lun)
do read(lun, *, iostat=ios) inums write(*,*)iostat=,ios if(is_iostat_eor(ios)) then stop end of record elseif(is_iostat_end(ios)) then print *,end of file exit elseif(ios.ne.0)then print *,I/O error,ios exit endif enddo
close(lun,iostat=ios,status=delete)
end program demo_is_iostat_eor
> iostat= 0 > iostat= -1 > end of file
Fortran 2003
Fortran intrinsic descriptions
o associated(3) - Association status of a pointer or pointer/target pair o extends_type_of(3) - Determine if the dynamic type of A is an extension of the dynamic type of MOLD. o is_iostat_end(3) - Test for end-of-file value o is_iostat_eor(3) - Test for end-of-record value o present(3) - Determine whether an optional dummy argument is specified o same_type_as(3) - Query dynamic types for equality
Nemo Release 3.1 | is_iostat_eor (3fortran) | November 02, 2024 |