1SEEKDIR(3P)                POSIX Programmer's Manual               SEEKDIR(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       seekdir - set the position of a directory stream
13

SYNOPSIS

15       #include <dirent.h>
16
17       void seekdir(DIR *dirp, long loc);
18
19

DESCRIPTION

21       The seekdir() function shall set the position  of  the  next  readdir()
22       operation  on  the  directory  stream specified by dirp to the position
23       specified by loc. The value of loc should have been  returned  from  an
24       earlier  call to telldir(). The new position reverts to the one associ‐
25       ated with the directory stream when telldir() was performed.
26
27       If the value of loc was not obtained from an earlier call to telldir(),
28       or  if a call to rewinddir() occurred between the call to telldir() and
29       the call to seekdir(), the results of subsequent calls to readdir() are
30       unspecified.
31

RETURN VALUE

33       The seekdir() function shall not return a value.
34

ERRORS

36       No errors are defined.
37
38       The following sections are informative.
39

EXAMPLES

41       None.
42

APPLICATION USAGE

44       None.
45

RATIONALE

47       The original standard developers perceived that there were restrictions
48       on the use of the seekdir() and telldir() functions related  to  imple‐
49       mentation details, and for that reason these functions need not be sup‐
50       ported on all POSIX-conforming systems. They are required on  implemen‐
51       tations supporting the XSI extension.
52
53       One  of the perceived problems of implementation is that returning to a
54       given point in a directory is quite difficult to describe formally,  in
55       spite  of  its intuitive appeal, when systems that use B-trees, hashing
56       functions, or other similar mechanisms to order their  directories  are
57       considered.  The definition of seekdir() and telldir() does not specify
58       whether, when using these interfaces, a given directory entry  will  be
59       seen at all, or more than once.
60
61       On  systems  not supporting these functions, their capability can some‐
62       times be accomplished by saving a filename found by readdir() and later
63       using rewinddir() and a loop on readdir() to relocate the position from
64       which the filename was saved.
65

FUTURE DIRECTIONS

67       None.
68

SEE ALSO

70       opendir(),  readdir(),  telldir(),  the  Base  Definitions  volume   of
71       IEEE Std 1003.1-2001, <dirent.h>, <stdio.h>, <sys/types.h>
72
74       Portions  of  this text are reprinted and reproduced in electronic form
75       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
76       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
77       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
78       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
79       event of any discrepancy between this version and the original IEEE and
80       The  Open Group Standard, the original IEEE and The Open Group Standard
81       is the referee document. The original Standard can be  obtained  online
82       at http://www.opengroup.org/unix/online.html .
83
84
85
86IEEE/The Open Group                  2003                          SEEKDIR(3P)
Impressum