Manual Reference Pages  - is_iostat_eor (3fortran)

NAME

IS_IOSTAT_EOR(3) - [STATE:INQUIRY] Test for end-of-record value

SYNOPSIS

result = is_iostat_eor(i)

         elemental integer function is_iostat_eor(i)

integer(kind=KIND),intent(in) :: i

CHARACTERISTICS

o I is integer of any kind
o the return value is a default logical

DESCRIPTION

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.

OPTIONS

o I : The value to test as indicating "end of record".

RESULT

Returns .true. if and only if I has the value which indicates an end-of-record condition for iostat= specifiers, and is .false. otherwise.

EXAMPLES

Sample program:

    program demo_is_iostat_eor
    use iso_fortran_env, only : iostat_eor
    implicit none
    integer :: inums(5), lun, ios

! 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

Results:

     >  iostat=           0
     >  iostat=          -1
     >  end of file

STANDARD

Fortran 2003

SEE ALSO

****(3)

fortran-lang intrinsic descriptions


Nemo Release 3.1 is_iostat_eor (3fortran) April 28, 2024
Generated by manServer 1.08 from ea4021a2-b8bc-4de0-87d6-fbe83f83902a using man macros.