IS_IOSTAT_END(3) - [STATE:INQUIRY] Test for end-of-file value
result = is_iostat_end(i)
elemental logical function is_iostat_end(i)integer,intent(in) :: i
o I is integer of any kind o the return value is a default logical
IS_IOSTAT_END(3) tests whether a variable (assumed returned as a status from an I/O statement) has the "end of file" I/O status value.
The function is equivalent to comparing the variable with the IOSTAT_END parameter of the intrinsic module ISO_FORTRAN_ENV.
o I : An integer status value to test if indicating end of file.
returns .true. if and only ifI has the value which indicates an end of file condition for IOSTAT= specifiers, and is .false. otherwise.
Sample program:
program demo_iostat implicit none real :: value integer :: ios character(len=256) :: message write(*,*)Begin entering numeric values, one per line do read(*,*,iostat=ios,iomsg=message)value if(ios.eq.0)then write(*,*)VALUE=,value elseif( is_iostat_end(ios) ) then stop end of file. Goodbye! else write(*,*)ERROR:,ios,trim(message) exit endif ! enddo end program demo_iostat
Fortran 2003
****(3)
fortran-lang intrinsic descriptions (license: MIT) @urbanjost
Nemo Release 3.1 | is_iostat_end (3fortran) | April 28, 2024 |