1closedir(3) Library Functions Manual closedir(3)
2
3
4
6 closedir - close a directory
7
9 Standard C library (libc, -lc)
10
12 #include <sys/types.h>
13 #include <dirent.h>
14
15 int closedir(DIR *dirp);
16
18 The closedir() function closes the directory stream associated with
19 dirp. A successful call to closedir() also closes the underlying file
20 descriptor associated with dirp. The directory stream descriptor dirp
21 is not available after this call.
22
24 The closedir() function returns 0 on success. On error, -1 is re‐
25 turned, and errno is set to indicate the error.
26
28 EBADF Invalid directory stream descriptor dirp.
29
31 For an explanation of the terms used in this section, see at‐
32 tributes(7).
33
34 ┌────────────────────────────────────────────┬───────────────┬─────────┐
35 │Interface │ Attribute │ Value │
36 ├────────────────────────────────────────────┼───────────────┼─────────┤
37 │closedir() │ Thread safety │ MT-Safe │
38 └────────────────────────────────────────────┴───────────────┴─────────┘
39
41 POSIX.1-2008.
42
44 POSIX.1-2001, SVr4, 4.3BSD.
45
47 close(2), opendir(3), readdir(3), rewinddir(3), scandir(3), seekdir(3),
48 telldir(3)
49
50
51
52Linux man-pages 6.05 2023-07-20 closedir(3)