.TH telldir() "" "" "General Function (libc)"
.PC "Return the current position within a directory stream"
\fBoff_t telldir (\fIdirp\^\fB)\fR
\fBDIR *\fIdirp\^\fB;\fR
.PP
The \*(CO function
.B telldir()
is one of a set of \*(CO routines that manipulate directories in a
device-independent manner.
It returns the current position within the directory stream
pointed to by
.IR dirp .
.PP
If an error occurs,
.B telldir()
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 "seekdir()," seekdir
.SH Notes
The value returned by
.B telldir()
should only be used as an argument to
.IR seekdir() .
.PP
.B telldir()
and
.B seekdir()
are unreliable when
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.
