1CLOSEDIR(3) Linux Programmer's Manual CLOSEDIR(3)
2
3
4
6 closedir - close a directory
7
9 #include <sys/types.h>
10 #include <dirent.h>
11
12 int closedir(DIR *dirp);
13
15 The closedir() function closes the directory stream associated with
16 dirp. A successful call to closedir() also closes the underlying file
17 descriptor associated with dirp. The directory stream descriptor dirp
18 is not available after this call.
19
21 The closedir() function returns 0 on success. On error, -1 is re‐
22 turned, and errno is set to indicate the error.
23
25 EBADF Invalid directory stream descriptor dirp.
26
28 For an explanation of the terms used in this section, see at‐
29 tributes(7).
30
31 ┌────────────────────────────────────────────┬───────────────┬─────────┐
32 │Interface │ Attribute │ Value │
33 ├────────────────────────────────────────────┼───────────────┼─────────┤
34 │closedir() │ Thread safety │ MT-Safe │
35 └────────────────────────────────────────────┴───────────────┴─────────┘
36
38 POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
39
41 close(2), opendir(3), readdir(3), rewinddir(3), scandir(3), seekdir(3),
42 telldir(3)
43
45 This page is part of release 5.12 of the Linux man-pages project. A
46 description of the project, information about reporting bugs, and the
47 latest version of this page, can be found at
48 https://www.kernel.org/doc/man-pages/.
49
50
51
52 2021-03-22 CLOSEDIR(3)