[UP]


Manual Reference Pages  - print_inquire (3)

NAME

print_inquire(3f) - [M_io] Do INQUIRE on file by name/number and print results (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Example
Author
License

SYNOPSIS

Definition:

   subroutine print_inquire(lun)
     or
   subroutine print_inquire(name)
   integer,intent(in),optional          :: lun
   character(len=*),intent(in),optional :: name

DESCRIPTION

Given either a Fortran file-unit-number or filename, call the INQUIRE(3f) intrinsic and print typical status information.

OPTIONS

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

EXAMPLE

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.ne.0)exit
         write(*,’(a)’,advance=’no’)’enter mode ([rwa][bt][+]>’
         read(*,’(a)’,iostat=ios)mode
         if(ios.ne.0)exit
         lun=fileopen(filename,mode,ios)
         if(ios.eq.0)then
            write(*,*)’OPENED’
         else
            write(*,*)’ERROR: IOS=’,ios
         endif
         if(lun.ne.-1)then
            call print_inquire(lun,’’)
            close(lun,iostat=ios,iomsg=message)
            if(ios.ne.0)then
               write(*,’(a)’)trim(message)
            endif
         endif
      enddo
   end program demo_print_inquire

AUTHOR

John S. Urban

LICENSE

Public Domain


print_inquire (3) March 11, 2021
Generated by manServer 1.08 from 2da4bb81-d544-4b80-93d6-06c528cf5552 using man macros.