Blame

f1d073 Bob Green 2026-08-26 12:08:32
1
% opendir(3) Version 1.0 | Library Functions Manual
2
***
3
4
## NAME
5
6
**opendir** — open a directory
7
8
### LIBRARY
9
10
libmega C library (-lmega)
11
12
### SYNOPSIS
13
14
```
15
#include <dirent.h>
16
17
DIR *opendir(const char *name);
18
```
19
20
### DESCRIPTION
21
The **opendir()** function opens a directory stream corresponding to the directory name, and returns a pointer to the directory stream. The stream is positioned at the first entry in the directory.
22
23
### RETURN VALUE
24
**opendir()** returns a pointer to the directory stream. On error, **NULL** is returned, and **_errno_** is set to indicate the error.
25
26
### ERRORS
27
**opendir()** can fail with the following errors:
28
29
* EMFILE - The limit on the number of open file descriptors has been reached.
30
* ENOENT - Directory does not exist, or **name** is an empty string.
31
* ENOTDIR - **name** is not a directory.
32
33
### NOTES
34
35
Filename entries can be read from a directory stream using readdir(3).
36
37
The underlying file descriptor of the directory stream can be obtained using **dirfd(3)**.
38
39
### BUGS
40
41
See GitHub Issues: <https://github.com/znac049/mega-micros-sbc3/issues>
42
43
### AUTHOR
44
45
Bob Green <bob@chippers.org.uk>
46
47
### SEE ALSO
48
**open(2)**, **closedir(3)**, **dirfd(3)**, **readdir(3)**, **rewinddir(3)**, **seekdir(3)**, **telldir(3)**