.TH seekdir() "" "" "General Function (libc)"
.PC "Reset the position within a directory stream"
\fBvoid seekdir (\fIdirp\^\fB, \fIloc\^\fB)\fR
\fBDIR *\fIdirp\^\fB;\fR
\fBoff_t \fIloc\^\fB;\fR
.PP
The function
.B seekdir()
is one of a set of \*(CO routines that manipulate directories in a
device-independent manner.
It resets the current position within the directory stream pointed to by
.I dirp
to
.IR loc .
.I loc
must be a position indicator returned by a previous call to
.BR telldir() .
.PP
If an error occurs,
.B seekdir()
exits and sets
.B errno
to an appropriate value.
.SH "See Also"
.Xr "closedir()," closedir
.Xr "dirent.h," dirent.h
.Xr "getdents()," getdents
.Xr "libc," libc
.Xr "opendir()," opendir
.Xr "readdir()," readdir
.Xr "rewinddir()," rewinddir
.Xr "telldir()" telldir
.SH Notes
.B telldir()
and
.B seekdir()
are unreliable when the directory stream has been closed and reopened.
It is best to avoid using
.B telldir()
and
.B seekdir()
altogether.
.PP
Because directory entries can dynamically appear and disappear,
and because directory contents are buffered by these routines,
an application may need to continually rescan
a directory to maintain an accurate picture
of its active entries.
.PP
.II "Gwynn, D."
The \*(CO implementation of the \fBdirent\fR routines
was written by D. Gwynn.
