blob: 2e426f0afadbec80de549d2fa4b25183f138a8a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
<title>Directory functions.</title>
<head>
<script language="JavaScript">
</script>
</head>
<body bgcolor="#ffffcc">
<hr>
<center>
<h1>Directory functions</h1>
</center>
<hr>
<p>
OK. First things first. These functions are NOT part of the ANSI standard
library. They may not be supported on your platform.
<p>
Here is a quick summary of each function, they are listed in the order in
which you may want to execute them.
</ul>
<li><b>opendir</b> Open a directory stream.
<li><b>readdir</b> read the current entry in the stream.
<li><b>scandir</b> Find an entry in a direcory.
<li><b>seekdir</b> Jump to a directory offset.
<li><b>telldir</b> Return the current location within the directory stream.
<li><b>rewinddir</b> Return to the start of the directory stream.
<li><b>closedir</b> Close a directory.
</ul>
<hr>
<table bgcolor=ivory>
<tr>
<td>
<pre>
Library: dirent.h
Prototype: DIR *opendir(const char *name);
struct dirent *readdir(DIR *dir);
int scandir(const char *dir, struct dirent ***namelist,
int (*select)(const struct dirent *),
int (*compar)(const void *, const void *));
void seekdir(DIR *dir, off_t offset);
off_t telldir(DIR *dir);
void rewinddir(DIR *dir);
int closedir(DIR *dir);
</pre>
</td>
</tr>
</table>
The dirent structure does not seem to be documented in the man pages,
so here it is.
<p>
<table bgcolor=ivory>
<tr>
<td>
<pre>
struct dirent
{
long d_ino;
off_t d_off;
unsigned short d_reclen;
char d_name[NAME_MAX+1];
};
</pre>
</td>
</tr>
</table>
<img src=../../GRAPHICS/computer.gif>
<a href="../EXAMPLES/dir.c"> example program</a> using opendir, readdir and closedir.
<p>
<hr>
<h2>See Also:</h2>
<img src=../../GRAPHICS/whiteball.gif>
<a href=stat.html>stat</a> function.
<p>
<hr>
<h2>man Pages:</h2>
<img src=../../GRAPHICS/man.gif>
<a href="../MAN/opendir.htm">opendir</a>
<img src=../../GRAPHICS/man.gif>
<a href="../MAN/readdir.htm">readdir</a>
<img src=../../GRAPHICS/man.gif>
<a href="../MAN/scandir.htm">scandir</a>
<img src=../../GRAPHICS/man.gif>
<a href="../MAN/seekdir.htm">seekdir</a>
<img src=../../GRAPHICS/man.gif>
<a href="../MAN/telldir.htm">telldir</a>
<img src=../../GRAPHICS/man.gif>
<a href="../MAN/rewinddir.htm">rewinddir</a>
<img src=../../GRAPHICS/man.gif>
<a href="../MAN/closedir.htm">closedir</a>
<p>
<hr>
<p>
<center>
<table border=2 width="80%" bgcolor="ivory">
<tr align=center>
<td width="25%">
<a href="../cref.html"> Top</a>
</td><td width="25%">
<a href="../master_index.html"> Master Index</a>
</td><td width="25%">
<a href="../SYNTAX/keywords.html"> Keywords</a>
</td><td width="25%">
<a href="funcref.htm"> Functions</a>
</td>
</tr>
</table>
</center>
<p>
<hr>
<address>Martin Leslie
</address><p>
</body>
</html>
|