1TELLDIR(3)                 Linux Programmer's Manual                TELLDIR(3)
2
3
4

NAME

6       telldir - return current location in directory stream
7

SYNOPSIS

9       #include <dirent.h>
10
11       long telldir(DIR *dirp);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       telldir():
16        _XOPEN_SOURCE
17           || /* Glibc since 2.19: */ _DEFAULT_SOURCE
18           || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
19

DESCRIPTION

21       The telldir() function returns the current location associated with the
22       directory stream dirp.
23

RETURN VALUE

25       On success, the telldir() function returns the current location in  the
26       directory stream.  On error, -1 is returned, and errno is set appropri‐
27       ately.
28

ERRORS

30       EBADF  Invalid directory stream descriptor dirp.
31

ATTRIBUTES

33       For  an  explanation  of  the  terms  used   in   this   section,   see
34       attributes(7).
35
36       ┌──────────┬───────────────┬─────────┐
37Interface Attribute     Value   
38       ├──────────┼───────────────┼─────────┤
39telldir() │ Thread safety │ MT-Safe │
40       └──────────┴───────────────┴─────────┘

CONFORMING TO

42       POSIX.1-2001, POSIX.1-2008, 4.3BSD.
43

NOTES

45       In  glibc  up to version 2.1.1, the return type of telldir() was off_t.
46       POSIX.1-2001 specifies long, and this is  the  type  used  since  glibc
47       2.1.2.
48
49       In early filesystems, the value returned by telldir() was a simple file
50       offset within a directory.  Modern filesystems use tree or hash  struc‐
51       tures,  rather  than  flat  tables,  to represent directories.  On such
52       filesystems, the value returned by telldir() (and  used  internally  by
53       readdir(3))  is a "cookie" that is used by the implementation to derive
54       a position within a directory.  Application programs should treat  this
55       strictly as an opaque value, making no assumptions about its contents.
56

SEE ALSO

58       closedir(3),    opendir(3),   readdir(3),   rewinddir(3),   scandir(3),
59       seekdir(3)
60

COLOPHON

62       This page is part of release 5.04 of the Linux  man-pages  project.   A
63       description  of  the project, information about reporting bugs, and the
64       latest    version    of    this    page,    can     be     found     at
65       https://www.kernel.org/doc/man-pages/.
66
67
68
69                                  2017-09-15                        TELLDIR(3)
Impressum