Annotated edit history of
readdir(3) version 1, including all changes.
View license author blame.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
READDIR |
|
|
2 |
!!!READDIR |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
ERRORS |
|
|
8 |
CONFORMING TO |
|
|
9 |
BUGS |
|
|
10 |
SEE ALSO |
|
|
11 |
---- |
|
|
12 |
!!NAME |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
readdir - read a directory |
|
|
16 |
!!SYNOPSIS |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
__#include |
|
|
20 |
__''dir''__); |
|
|
21 |
__ |
|
|
22 |
!!DESCRIPTION |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
The __readdir()__ function returns a pointer to a dirent |
|
|
26 |
structure representing the next directory entry in the |
|
|
27 |
directory stream pointed to by ''dir''. It returns NULL |
|
|
28 |
on reaching the end-of-file or if an error |
|
|
29 |
occurred. |
|
|
30 |
|
|
|
31 |
|
|
|
32 |
The data returned by __readdir()__ is overwritten by |
|
|
33 |
subsequent calls to __readdir()__ for the same directory |
|
|
34 |
stream. |
|
|
35 |
|
|
|
36 |
|
|
|
37 |
The ''dirent'' structure is defined as |
|
|
38 |
follows: |
|
|
39 |
|
|
|
40 |
|
|
|
41 |
struct dirent { |
|
|
42 |
long d_ino; /* inode number */ |
|
|
43 |
off_t d_off; /* offset to the next dirent */ |
|
|
44 |
unsigned short d_reclen;/* length of this record */ |
|
|
45 |
unsigned char d_type; /* type of file */ |
|
|
46 |
char d_name[[256]; /* filename */ |
|
|
47 |
}; |
|
|
48 |
!!RETURN VALUE |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
The __readdir()__ function returns a pointer to a dirent |
|
|
52 |
structure, or NULL if an error occurs or end-of-file is |
|
|
53 |
reached. |
|
|
54 |
!!ERRORS |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
__EBADF__ |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
Invalid directory stream descriptor ''dir''. |
|
|
61 |
!!CONFORMING TO |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
SVID 3, POSIX, BSD 4.3 |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
According to POSIX, the ''dirent'' structure contains a |
|
|
68 |
field ''char d_name[[]'' of unspecified size, with at most |
|
|
69 |
__NAME_MAX__ characters preceding the terminating null |
|
|
70 |
character. Use of other fields will harm the portability of |
|
|
71 |
your programs. |
|
|
72 |
!!BUGS |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
Field ''d_type'' is not implemented as of libc6 2.1 and |
|
|
76 |
will always return DT_UNKNOWN (0). |
|
|
77 |
!!SEE ALSO |
|
|
78 |
|
|
|
79 |
|
|
|
80 |
read(2), opendir(3), closedir(3), |
|
|
81 |
rewinddir(3), seekdir(3), telldir(3), |
|
|
82 |
scandir(3) |
|
|
83 |
---- |
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.