This module contains part of a Fortran API to functions detailed in ISO/IEC 9945-1:1990 Portable Operating System Interface (POSIX) - Part 1: System Application Program Interface (API) [C Language].
The functions in this module are from Section 5.1.2: Directory Operations
Error handling is described in F90_UNIX_ERRNO. Note that for procedures with an optional ERRNO argument, if an error occurs and ERRNO is not present, the program will be terminated.
If DIRUNIT does not refer to an open directory stream, error EBADF (see F90_UNIX_ERRNO) is raised.
SUBROUTINE OPENDIR(DIRNAME,DIRUNIT,ERRNO)
CHARACTER*(*),INTENT(IN) :: DIRNAME
INTEGER,INTENT(OUT) :: DIRUNIT
INTEGER,OPTIONAL,INTENT(OUT) :: ERRNO
Possible errors include EACCES, ENAMETOOLONG, ENOENT, ENOTDIR, EMFILE and ENFILE (see F90_UNIX_ERRNO).
SUBROUTINE READDIR(DIRUNIT,NAME,LENNAME,ERRNO)
INTEGER,INTENT(IN) :: DIRUNIT
CHARACTER*(*),INTENT(OUT) :: NAME
INTEGER,INTENT(OUT) :: LENNAME
INTEGER,OPTIONAL,INTENT(OUT) :: ERRNO
If there are no more directory entries, NAME is undefined and LENNAME is negative.
If DIRUNIT is not a directory stream handle produced by OPENDIR, or has been closed by CLOSEDIR, error EBADF (see F90_UNIX_ERRNO) is raised.
SUBROUTINE REWINDDIR(DIRUNIT,ERRNO)
INTEGER,INTENT(IN) :: DIRUNIT
INTEGER,OPTIONAL,INTENT(OUT) :: ERRNO
© The Numerical Algorithms Group Ltd, Oxford UK. 2001