📄 opendir.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>opendir</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_007_928"> </a>NAME</h4><blockquote>opendir - open a directory</blockquote><h4><a name = "tag_000_007_929"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="systypes.h.html">sys/types.h</a>>#include <<a href="dirent.h.html">dirent.h</a>>DIR *opendir(const char *<i>dirname</i>);</code></pre></blockquote><h4><a name = "tag_000_007_930"> </a>DESCRIPTION</h4><blockquote>The<i>opendir()</i>function opens a directory stream corresponding to the directorynamed by the<i>dirname</i>argument.The directory stream is positioned at the first entry.If the type<b>DIR</b>,is implemented using a file descriptor,applications will only be able to open up to a total of{OPEN_MAX}files and directories.A successful call to any of the<i>exec</i>functions will close any directory streams that are open in thecalling process.</blockquote><h4><a name = "tag_000_007_931"> </a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>opendir()</i>returns a pointer to an object of type<b>DIR</b>.Otherwise, a null pointer is returned and<i>errno</i>is set to indicate the error.</blockquote><h4><a name = "tag_000_007_932"> </a>ERRORS</h4><blockquote>The<i>opendir()</i>function will fail if:<dl compact><dt>[EACCES]<dd>Search permission is denied for the component of the path prefix of<i>dirname</i>or read permission is denied for<i>dirname.</i><dt>[ELOOP]<dd>Too many symbolic links were encountered in resolving <i>path</i>.<dt>[ENAMETOOLONG]<dd>The length of the<i>dirname</i>argument exceeds {PATH_MAX},or a pathname component is longer than {NAME_MAX}.<dt>[ENOENT]<dd>A component of <i>dirname</i> does not name an existing directoryor <i>dirname</i> is an empty string.<dt>[ENOTDIR]<dd>A component of<i>dirname</i>is not a directory.</dl><p>The<i>opendir()</i>function may fail if:<dl compact><dt>[EMFILE]<dd>{OPEN_MAX} file descriptors are currently open in the calling process.<dt>[ENAMETOOLONG]<dd>Pathname resolution of a symbolic link produced an intermediate result whoselength exceeds {PATH_MAX}.<dt>[ENFILE]<dd>Too many files are currently open in the system.</dl></blockquote><h4><a name = "tag_000_007_933"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_934"> </a>APPLICATION USAGE</h4><blockquote>The<i>opendir()</i>function should be used in conjunction with<i><a href="readdir.html">readdir()</a></i>,<i><a href="closedir.html">closedir()</a></i>and<i><a href="rewinddir.html">rewinddir()</a></i>to examine the contents of the directory (see the EXAMPLES section in<i><a href="readdir.html">readdir()</a></i>).This method is recommended for portability.</blockquote><h4><a name = "tag_000_007_935"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_936"> </a>SEE ALSO</h4><blockquote><i><a href="closedir.html">closedir()</a></i>,<i><a href="lstat.html">lstat()</a></i>,<i><a href="readdir.html">readdir()</a></i>,<i><a href="rewinddir.html">rewinddir()</a></i>,<i><a href="symlink.html">symlink()</a></i>,<i><a href="dirent.h.html"><dirent.h></a></i>,<i><a href="limits.h.html"><limits.h></a></i>,<i><a href="systypes.h.html"><sys/types.h></a></i>.<br></blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -