.TH DIRECTORY 3C "Standard Extension"
opendir, readdir, telldir, seekdir, rewinddir, closedir \- directory operations
.B "#include <sys/types.h>"
.B "#include <isode/usr.dirent.h>"
.B "DIR \(**opendir (dirname)"
.B "struct dirent \(**readdir (dirp)"
.B "off_t telldir (dirp)"
.B "void seekdir (dirp, loc)"
.B "void rewinddir (dirp)"
establishes a connection between
and a unique object of type
returns a pointer to be used to identify the
in subsequent operations.
cannot be accessed or is not a directory,
(perhaps due to insufficient memory).
returns a pointer to an internal structure
containing information about the next active directory entry.
No inactive entries are reported.
The internal structure may be overwritten by
another operation on the same
the amount of storage needed to hold a copy
of the internal structure is given by the value of a macro,
.IR DIRENTSIZ(strlen(direntp\->d_name)) ,
.I "sizeof(struct\ dirent)"
upon reaching the end of the directory,
upon detecting an invalid location in the directory,
or upon occurrence of an error while reading the directory.
returns the current position associated with the named
for later use as an argument to
sets the position of the next
The new position reverts to the one associated with the
was obtained was performed.
resets the position of the named
to the beginning of the directory.
All buffered data for the directory stream is discarded,
thereby guaranteeing that the actual
file system directory will be referred to for the next
internal resources used for the
directory stream are liberated,
and subsequent use of the associated
object is no longer valid.
returns a value of zero if no error occurs,
There are several possible errors that can occur
as a result of these operations;
the external integer variable
is set to indicate the specific error.
detection of the normal end of a directory
is not considered to be an error.)
Sample code which searches the current working directory for entry
while ( (dp = readdir( dirp )) != NULL )
if ( strcmp( dp\->d_name, name ) == 0 )
may not be reported for some file system types.
need not have any simple interpretation
and should only be used as an argument to
must be obtained from a previous
are unreliable when used in conjunction with
file systems that perform directory compaction or expansion
or when the directory stream has been closed and reopened.
It is best to avoid using
values and meanings may vary among implementations.
Because directory entries can dynamically
and because directory contents are buffered
an application may need to continually rescan
a directory to maintain an accurate picture