Manual Reference Pages  - system_closedir (3m_system)

NAME

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

CONTENTS

Synopsis
Description
Options
Errors
Examples
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.

EXAMPLES

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


Nemo Release 3.1 system_closedir (3m_system) March 07, 2025
Generated by manServer 1.08 from 2e0c46b9-58e6-40eb-9e02-f05a6495235c using man macros.