telldir usage

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Apr 4 06:35:38 AEST 1989


In article <76 at estinc.UUCP> fnf at estinc.UUCP (Fred Fish) writes:
>Is it legal to do a telldir on an open directory, close the directory,
>and then come back later to open the directory and use the telldir
>value in a seekdir call to pick up where you left off?

>From the manual entry I provide with my public-domain implementation
of the directory access routines:

DESCRIPTION
...
Telldir returns the current position associated with the named directory
stream for later use as an argument to seekdir.

Seekdir sets the position of the next readdir operation on the named
directory stream.  The new position reverts to the one associated with
the directory stream when the telldir operation from which loc was
obtained was performed.
...
WARNINGS
...
The value returned by telldir need not have any simple interpretation
and should only be used as an argument to seekdir.  Similarly, the loc
argument to seekdir must be obtained from a previous telldir operation
on the same directory stream.

Telldir and seekdir 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 telldir and seekdir altogether.



More information about the Comp.unix.wizards mailing list