1SEEKDIR(P) POSIX Programmer's Manual SEEKDIR(P)
2
3
4
6 seekdir - set the position of a directory stream
7
9 #include <dirent.h>
10
11 void seekdir(DIR *dirp, long loc);
12
13
15 The seekdir() function shall set the position of the next readdir()
16 operation on the directory stream specified by dirp to the position
17 specified by loc. The value of loc should have been returned from an
18 earlier call to telldir(). The new position reverts to the one associ‐
19 ated with the directory stream when telldir() was performed.
20
21 If the value of loc was not obtained from an earlier call to telldir(),
22 or if a call to rewinddir() occurred between the call to telldir() and
23 the call to seekdir(), the results of subsequent calls to readdir() are
24 unspecified.
25
27 The seekdir() function shall not return a value.
28
30 No errors are defined.
31
32 The following sections are informative.
33
35 None.
36
38 None.
39
41 The original standard developers perceived that there were restrictions
42 on the use of the seekdir() and telldir() functions related to imple‐
43 mentation details, and for that reason these functions need not be sup‐
44 ported on all POSIX-conforming systems. They are required on implemen‐
45 tations supporting the XSI extension.
46
47 One of the perceived problems of implementation is that returning to a
48 given point in a directory is quite difficult to describe formally, in
49 spite of its intuitive appeal, when systems that use B-trees, hashing
50 functions, or other similar mechanisms to order their directories are
51 considered. The definition of seekdir() and telldir() does not specify
52 whether, when using these interfaces, a given directory entry will be
53 seen at all, or more than once.
54
55 On systems not supporting these functions, their capability can some‐
56 times be accomplished by saving a filename found by readdir() and later
57 using rewinddir() and a loop on readdir() to relocate the position from
58 which the filename was saved.
59
61 None.
62
64 opendir() , readdir() , telldir() , the Base Definitions volume of
65 IEEE Std 1003.1-2001, <dirent.h>, <stdio.h>, <sys/types.h>
66
68 Portions of this text are reprinted and reproduced in electronic form
69 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
70 -- Portable Operating System Interface (POSIX), The Open Group Base
71 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
72 Electrical and Electronics Engineers, Inc and The Open Group. In the
73 event of any discrepancy between this version and the original IEEE and
74 The Open Group Standard, the original IEEE and The Open Group Standard
75 is the referee document. The original Standard can be obtained online
76 at http://www.opengroup.org/unix/online.html .
77
78
79
80IEEE/The Open Group 2003 SEEKDIR(P)