| 1 |
'\" t |
| 2 |
.\" Copyright 1993, David Metcalfe <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH seekdir 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
seekdir \- set the position of the next readdir() call in the directory |
| 10 |
stream. |
| 11 |
.SH LIBRARY |
| 12 |
Standard C library |
| 13 |
.RI ( libc ,\~ \-lc ) |
| 14 |
.SH SYNOPSIS |
| 15 |
.nf |
| 16 |
.B #include <dirent.h> |
| 17 |
.P |
| 18 |
.BI "void seekdir(DIR *" dirp ", long " loc ); |
| 19 |
.fi |
| 20 |
.P |
| 21 |
.RS -4 |
| 22 |
Feature Test Macro Requirements for glibc (see |
| 23 |
.BR feature_test_macros (7)): |
| 24 |
.RE |
| 25 |
.P |
| 26 |
.BR seekdir (): |
| 27 |
.nf |
| 28 |
_XOPEN_SOURCE |
| 29 |
|| /* glibc >= 2.19: */ _DEFAULT_SOURCE |
| 30 |
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE |
| 31 |
.fi |
| 32 |
.SH DESCRIPTION |
| 33 |
The |
| 34 |
.BR seekdir () |
| 35 |
function sets the location in the directory stream |
| 36 |
from which the next |
| 37 |
.BR readdir (2) |
| 38 |
call will start. |
| 39 |
The |
| 40 |
.I loc |
| 41 |
argument should be a value returned by a previous call to |
| 42 |
.BR telldir (3). |
| 43 |
.SH RETURN VALUE |
| 44 |
The |
| 45 |
.BR seekdir () |
| 46 |
function returns no value. |
| 47 |
.SH ATTRIBUTES |
| 48 |
For an explanation of the terms used in this section, see |
| 49 |
.BR attributes (7). |
| 50 |
.TS |
| 51 |
allbox; |
| 52 |
lbx lb lb |
| 53 |
l l l. |
| 54 |
Interface Attribute Value |
| 55 |
T{ |
| 56 |
.na |
| 57 |
.nh |
| 58 |
.BR seekdir () |
| 59 |
T} Thread safety MT-Safe |
| 60 |
.TE |
| 61 |
.SH STANDARDS |
| 62 |
POSIX.1-2008. |
| 63 |
.SH HISTORY |
| 64 |
POSIX.1-2001, 4.3BSD. |
| 65 |
.SH CAVEATS |
| 66 |
Up to glibc 2.1.1, the type of the |
| 67 |
.I loc |
| 68 |
argument was |
| 69 |
.IR off_t . |
| 70 |
POSIX.1-2001 specifies |
| 71 |
.IR long , |
| 72 |
and this is the type used since glibc 2.1.2. |
| 73 |
See |
| 74 |
.BR telldir (3) |
| 75 |
for information on why you should be careful in making any |
| 76 |
assumptions about the value in this argument. |
| 77 |
.SH SEE ALSO |
| 78 |
.BR lseek (2), |
| 79 |
.BR closedir (3), |
| 80 |
.BR opendir (3), |
| 81 |
.BR readdir (3), |
| 82 |
.BR rewinddir (3), |
| 83 |
.BR scandir (3), |
| 84 |
.BR telldir (3) |