print_inquire(3f) - [M_io:QUERY] Do INQUIRE on file by name/number and print results (LICENSE:PD)
Synopsis
Description
Options
Examples
Author
License
Definition:
subroutine print_inquire(lun) or subroutine print_inquire(name) integer,intent(in),optional :: lun character(len=*),intent(in),optional :: name
Given either a Fortran file-unit-number or filename, call the INQUIRE(3f) intrinsic and print typical status information.
lun if lun is not equal to -1 then query by number and ignore filename even if present name if lun = -1 or is not present then query by this filename
Sample program:
program demo_print_inquire use M_io, only : print_inquire, fileopen implicit none character(len=4096) :: filename character(len=20) :: mode integer :: ios character(len=256) :: message integer :: lun do write(*,(a),advance=no)enter filename> read(*,(a),iostat=ios)filename if(ios /= 0)exit write(*,(a),advance=no)enter mode ([rwa][bt][+]> read(*,(a),iostat=ios)mode if(ios /= 0)exit lun=fileopen(filename,mode,ios) if(ios == 0)then write(*,*)OPENED else write(*,*)ERROR: IOS=,ios endif if(lun /= -1)then call print_inquire(lun,) close(lun,iostat=ios,iomsg=message) if(ios /= 0)then write(*,(a))trim(message) endif endif enddo end program demo_print_inquire
John S. Urban
Public Domain
Nemo Release 3.1 | print_inquire (3) | February 23, 2025 |