[UP]


Manual Reference Pages  - system_closedir (3)

NAME

system_closedir(3f) - [M_system:QUERY_FILE] close a directory stream by calling closedir(3c) (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Errors
Example
Author
License

SYNOPSIS

subroutine system_closedir(dir,ierr)

        type(c_ptr)         :: dir
        integer,intent(out) :: ierr

DESCRIPTION

The SYSTEM_CLOSEDIR(3f) function closes the directory stream referred to by the argument DIR. Upon return, the value of DIR may no longer point to an accessible object.

OPTIONS

dir directory stream pointer opened by SYSTEM_OPENDIR(3f).
ierr Upon successful completion, SYSTEM_CLOSEDIR(3f) returns 0; otherwise, an error has occurred.

ERRORS

system_closedir(3f) may fail if:
EBADF The dirp argument does not refer to an open directory stream.
EINTR The closedir() function was interrupted by a signal.

EXAMPLE

Sample program

   program demo_system_closedir
   use M_system, only : system_opendir,system_readdir
   use M_system, only : system_closedir, system_rewinddir
   use iso_c_binding, only : c_ptr
   implicit none
   type(c_ptr)                  :: dir
   character(len=:),allocatable :: filename
   integer                      :: ierr
   !--- open directory stream to read from
   call system_opendir(’.’,dir,ierr)
   !--- read directory stream
   do
      call system_readdir(dir,filename,ierr)
      if(filename.eq.’ ’)exit
      write(*,*)filename
   enddo
   call system_rewinddir(dir)
   !--- close directory stream
   call system_closedir(dir,ierr)
   end program demo_system_closedir

AUTHOR

John S. Urban

LICENSE

Public Domain


system_closedir (3) March 11, 2021
Generated by manServer 1.08 from 04bf8289-adcd-45fb-b68c-e9f7774d3062 using man macros.