亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? library_13.html

?? Glibc的中文手冊(cè)
?? HTML
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
<!-- This HTML file has been created by texi2html 1.27
     from library.texinfo on 3 March 1994 -->

<TITLE>The GNU C Library - File System Interface</TITLE>
<P>Go to the <A HREF="library_12.html" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html">previous</A>, <A HREF="library_14.html" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_14.html">next</A> section.<P>
<H1><A NAME="SEC187" HREF="library_toc.html#SEC187" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC187">File System Interface</A></H1>
<P>
This chapter describes the GNU C library's functions for manipulating
files.  Unlike the input and output functions described in
section <A HREF="library_11.html#SEC117" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_11.html#SEC117">Input/Output on Streams</A> and section <A HREF="library_12.html#SEC171" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC171">Low-Level Input/Output</A>, these
functions are concerned with operating on the files themselves, rather
than on their contents.
<P>
Among the facilities described in this chapter are functions for
examining or modifying directories, functions for renaming and deleting
files, and functions for examining and setting file attributes such as
access permissions and modification times.
<P>
<H2><A NAME="SEC188" HREF="library_toc.html#SEC188" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC188">Working Directory</A></H2>
<A NAME="IDX724"></A>
<A NAME="IDX725"></A>
<A NAME="IDX726"></A>
<P>
Each process has associated with it a directory, called its <DFN>current
working directory</DFN> or simply <DFN>working directory</DFN>, that is used in
the resolution of relative file names (see section <A HREF="library_10.html#SEC114" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_10.html#SEC114">File Name Resolution</A>).
<P>
When you log in and begin a new session, your working directory is
initially set to the home directory associated with your login account
in the system user database.  You can find any user's home directory
using the <CODE>getpwuid</CODE> or <CODE>getpwnam</CODE> functions; see section <A HREF="library_25.html#SEC441" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_25.html#SEC441">User Database</A>.
<P>
Users can change the working directory using shell commands like
<CODE>cd</CODE>.  The functions described in this section are the primitives
used by those commands and by other programs for examining and changing
the working directory.
<A NAME="IDX727"></A>
<P>
Prototypes for these functions are declared in the header file
<TT>`unistd.h'</TT>.
<A NAME="IDX728"></A>
<P>
<A NAME="IDX729"></A>
<U>Function:</U> char * <B>getcwd</B> <I>(char *<VAR>buffer</VAR>, size_t <VAR>size</VAR>)</I><P>
The <CODE>getcwd</CODE> function returns an absolute file name representing
the current working directory, storing it in the character array
<VAR>buffer</VAR> that you provide.  The <VAR>size</VAR> argument is how you tell
the system the allocation size of <VAR>buffer</VAR>.
<P>
The GNU library version of this function also permits you to specify a
null pointer for the <VAR>buffer</VAR> argument.  Then <CODE>getcwd</CODE>
allocates a buffer automatically, as with <CODE>malloc</CODE>
(see section <A HREF="library_3.html#SEC21" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_3.html#SEC21">Unconstrained Allocation</A>).  If the <VAR>size</VAR> is greater than
zero, then the buffer is that large; otherwise, the buffer is as large
as necessary to hold the result.
<P>
The return value is <VAR>buffer</VAR> on success and a null pointer on failure.
The following <CODE>errno</CODE> error conditions are defined for this function:
<P>
<DL COMPACT>
<DT><CODE>EINVAL</CODE>
<DD>The <VAR>size</VAR> argument is zero and <VAR>buffer</VAR> is not a null pointer.
<P>
<DT><CODE>ERANGE</CODE>
<DD>The <VAR>size</VAR> argument is less than the length of the working directory
name.  You need to allocate a bigger array and try again.
<P>
<DT><CODE>EACCES</CODE>
<DD>Permission to read or search a component of the file name was denied.
</DL>
<P>
Here is an example showing how you could implement the behavior of GNU's
<CODE>getcwd (NULL, 0)</CODE> using only the standard behavior of
<CODE>getcwd</CODE>:
<P>
<PRE>
char *
gnu_getcwd ()
{
  int size = 100;
  char *buffer = (char *) xmalloc (size);

  while (1)
    {
      char *value = getcwd (buffer, size);
      if (value != 0)
        return buffer;
      size *= 2;
      free (buffer);
      buffer = (char *) xmalloc (size);
    }
}
</PRE>
<P>
See section <A HREF="library_3.html#SEC23" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_3.html#SEC23">Examples of <CODE>malloc</CODE></A>, for information about <CODE>xmalloc</CODE>, which is
not a library function but is a customary name used in most GNU
software.
<P>
<A NAME="IDX730"></A>
<U>Function:</U> char * <B>getwd</B> <I>(char *<VAR>buffer</VAR>)</I><P>
This is similar to <CODE>getcwd</CODE>.  The GNU library provides <CODE>getwd</CODE>
for backwards compatibility with BSD.  The <VAR>buffer</VAR> should be a
pointer to an array at least <CODE>PATH_MAX</CODE> bytes long.
<P>
<A NAME="IDX731"></A>
<U>Function:</U> int <B>chdir</B> <I>(const char *<VAR>filename</VAR>)</I><P>
This function is used to set the process's working directory to
<VAR>filename</VAR>.
<P>
The normal, successful return value from <CODE>chdir</CODE> is <CODE>0</CODE>.  A
value of <CODE>-1</CODE> is returned to indicate an error.  The <CODE>errno</CODE>
error conditions defined for this function are the usual file name
syntax errors (see section <A HREF="library_10.html#SEC115" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_10.html#SEC115">File Name Errors</A>), plus <CODE>ENOTDIR</CODE> if the
file <VAR>filename</VAR> is not a directory.
<P>
<A NAME="IDX732"></A>
<A NAME="IDX733"></A>
<A NAME="IDX734"></A>
<H2><A NAME="SEC189" HREF="library_toc.html#SEC189" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC189">Accessing Directories</A></H2>
<P>
The facilities described in this section let you read the contents of a
directory file.  This is useful if you want your program to list all the
files in a directory, perhaps as part of a menu.
<A NAME="IDX735"></A>
<P>
The <CODE>opendir</CODE> function opens a <DFN>directory stream</DFN> whose
elements are directory entries.  You use the <CODE>readdir</CODE> function on
the directory stream to retrieve these entries, represented as
<CODE>struct dirent</CODE> objects.  The name of the file for each entry is
stored in the <CODE>d_name</CODE> member of this structure.  There are obvious
parallels here to the stream facilities for ordinary files, described in
section <A HREF="library_11.html#SEC117" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_11.html#SEC117">Input/Output on Streams</A>.
<P>
<H3><A NAME="SEC190" HREF="library_toc.html#SEC190" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC190">Format of a Directory Entry</A></H3>
<A NAME="IDX736"></A>
<P>
This section describes what you find in a single directory entry, as you
might obtain it from a directory stream.  All the symbols are declared
in the header file <TT>`dirent.h'</TT>.
<P>
<A NAME="IDX737"></A>
<U>Data Type:</U> <B>struct dirent</B><P>
This is a structure type used to return information about directory
entries.  It contains the following fields:
<P>
<DL COMPACT>
<DT><CODE>char *d_name</CODE>
<DD>This is the null-terminated file name component.  This is the only
field you can count on in all POSIX systems.
<P>
<DT><CODE>ino_t d_fileno</CODE>
<DD>This is the file serial number.  For BSD compatibility, you can also
refer to this member as <CODE>d_ino</CODE>.
<P>
<DT><CODE>size_t d_namlen</CODE>
<DD>This is the length of the file name, not including the terminating null
character.
</DL>
<P>
This structure may contain additional members in the future.
<P>
When a file has multiple names, each name has its own directory entry.
The only way you can tell that the directory entries belong to a
single file is that they have the same value for the <CODE>d_fileno</CODE>
field.
<P>
File attributes such as size, modification times, and the like are part
of the file itself, not any particular directory entry.  See section <A HREF="library_13.html#SEC200" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_13.html#SEC200">File Attributes</A>.
<P>
<H3><A NAME="SEC191" HREF="library_toc.html#SEC191" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC191">Opening a Directory Stream</A></H3>
<A NAME="IDX738"></A>
<P>
This section describes how to open a directory stream.  All the symbols
are declared in the header file <TT>`dirent.h'</TT>.
<P>
<A NAME="IDX739"></A>
<U>Data Type:</U> <B>DIR</B><P>
The <CODE>DIR</CODE> data type represents a directory stream.  
<P>
You shouldn't ever allocate objects of the <CODE>struct dirent</CODE> or
<CODE>DIR</CODE> data types, since the directory access functions do that for
you.  Instead, you refer to these objects using the pointers returned by
the following functions.
<P>
<A NAME="IDX740"></A>
<U>Function:</U> DIR * <B>opendir</B> <I>(const char *<VAR>dirname</VAR>)</I><P>
The <CODE>opendir</CODE> function opens and returns a directory stream for
reading the directory whose file name is <VAR>dirname</VAR>.  The stream has
type <CODE>DIR *</CODE>.
<P>
If unsuccessful, <CODE>opendir</CODE> returns a null pointer.  In addition to
the usual file name syntax errors (see section <A HREF="library_10.html#SEC115" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_10.html#SEC115">File Name Errors</A>), the
following <CODE>errno</CODE> error conditions are defined for this function:
<P>
<DL COMPACT>
<DT><CODE>EACCES</CODE>
<DD>Read permission is denied for the directory named by <CODE>dirname</CODE>.
<P>
<DT><CODE>EMFILE</CODE>
<DD>The process has too many files open.
<P>
<DT><CODE>ENFILE</CODE>
<DD>The entire system, or perhaps the file system which contains the
directory, cannot support any additional open files at the moment.
(This problem cannot happen on the GNU system.)
</DL>
<P>
The <CODE>DIR</CODE> type is typically implemented using a file descriptor,
and the <CODE>opendir</CODE> function in terms of the <CODE>open</CODE> function.
See section <A HREF="library_12.html#SEC171" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC171">Low-Level Input/Output</A>.  Directory streams and the underlying
file descriptors are closed on <CODE>exec</CODE> (see section <A HREF="library_23.html#SEC406" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_23.html#SEC406">Executing a File</A>).
<P>
<H3><A NAME="SEC192" HREF="library_toc.html#SEC192" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC192">Reading and Closing a Directory Stream</A></H3>
<A NAME="IDX741"></A>
<P>
This section describes how to read directory entries from a directory
stream, and how to close the stream when you are done with it.  All the
symbols are declared in the header file <TT>`dirent.h'</TT>.
<P>
<A NAME="IDX742"></A>
<U>Function:</U> struct dirent * <B>readdir</B> <I>(DIR *<VAR>dirstream</VAR>)</I><P>
This function reads the next entry from the directory.  It normally
returns a pointer to a structure containing information about the file.
This structure is statically allocated and can be rewritten by a
subsequent call.
<P>
<STRONG>Portability Note:</STRONG> On some systems, <CODE>readdir</CODE> may not
return entries for <TT>`.'</TT> and <TT>`..'</TT>.  See section <A HREF="library_10.html#SEC114" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_10.html#SEC114">File Name Resolution</A>.
<P>
If there are no more entries in the directory or an error is detected,
<CODE>readdir</CODE> returns a null pointer.  The following <CODE>errno</CODE> error
conditions are defined for this function:
<P>
<DL COMPACT>
<DT><CODE>EBADF</CODE>
<DD>The <VAR>dirstream</VAR> argument is not valid.
</DL>
<P>
<A NAME="IDX743"></A>
<U>Function:</U> int <B>closedir</B> <I>(DIR *<VAR>dirstream</VAR>)</I><P>
This function closes the directory stream <VAR>dirstream</VAR>.  It returns
<CODE>0</CODE> on success and <CODE>-1</CODE> on failure.  
<P>
The following <CODE>errno</CODE> error conditions are defined for this
function:
<P>
<DL COMPACT>
<DT><CODE>EBADF</CODE>
<DD>The <VAR>dirstream</VAR> argument is not valid.
</DL>
<P>
<H3><A NAME="SEC193" HREF="library_toc.html#SEC193" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC193">Simple Program to List a Directory</A></H3>
<P>
Here's a simple program that prints the names of the files in
the current working directory:
<P>
<PRE>
#include &#60;stddef.h&#62;
#include &#60;stdio.h&#62;
#include &#60;sys/types.h&#62;
#include &#60;dirent.h&#62;

int
main (void)
{
  DIR *dp;
  struct dirent *ep;

  dp = opendir ("./");
  if (dp != NULL)
    {
      while (ep = readdir (dp))
	puts (ep-&#62;d_name);
      (void) closedir (dp);

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕亚洲区| 日韩精品一区在线观看| 久久精品日韩一区二区三区| 粉嫩av亚洲一区二区图片| 国产精品国产三级国产有无不卡 | 亚洲视频你懂的| 欧美日韩国产一级片| 蜜桃av一区二区在线观看| 久久久美女艺术照精彩视频福利播放| 亚洲美女一区二区三区| 欧美一a一片一级一片| 日韩一区精品视频| 国产拍揄自揄精品视频麻豆| av午夜精品一区二区三区| 亚洲一区二区三区四区五区黄| 久久精品国产久精国产爱| 久久午夜电影网| 99国产欧美久久久精品| 亚洲在线中文字幕| 欧美精品一区二区三区蜜臀| 91一区二区在线| 久久伊人中文字幕| 91啦中文在线观看| 蜜桃一区二区三区在线观看| 久久精品在线免费观看| 欧美在线视频你懂得| 日韩电影在线看| 综合中文字幕亚洲| 精品毛片乱码1区2区3区| 一本大道综合伊人精品热热| 日韩成人免费看| 亚洲图片欧美激情| 精品日韩成人av| 在线看不卡av| 黑人精品欧美一区二区蜜桃| 亚洲乱码日产精品bd| 在线成人小视频| av在线播放一区二区三区| 日韩精品乱码av一区二区| 2019国产精品| 欧美日韩国产美| 不卡一二三区首页| 久久精品av麻豆的观看方式| 亚洲午夜在线视频| 国产精品污www在线观看| 欧洲一区在线电影| 国产99精品视频| 日韩精彩视频在线观看| 亚洲人精品一区| 国产精品久久精品日日| 91精品欧美久久久久久动漫 | 99re6这里只有精品视频在线观看| 丝袜亚洲另类丝袜在线| 国产精品女上位| 久久久亚洲高清| 欧美成人精品福利| 69久久99精品久久久久婷婷| 欧美精品v国产精品v日韩精品| 色婷婷综合久色| 亚洲成人精品一区| 亚洲国产成人av好男人在线观看| 亚洲人成网站色在线观看| 国产精品二三区| 国产精品久久久一本精品| 日韩午夜在线影院| 欧美影片第一页| 欧美性猛片xxxx免费看久爱| 99久久综合国产精品| 国产一区二区网址| 激情六月婷婷久久| 国内精品久久久久影院色| 日本vs亚洲vs韩国一区三区二区| 亚洲成av人**亚洲成av**| 亚洲国产毛片aaaaa无费看| 日韩视频免费观看高清完整版在线观看 | 成人小视频在线| 经典一区二区三区| 国产精品亚洲一区二区三区在线| 综合中文字幕亚洲| 亚洲乱码国产乱码精品精小说| 日韩毛片视频在线看| 亚洲视频中文字幕| 一区二区三区91| 日韩欧美中文字幕精品| 91麻豆成人久久精品二区三区| 91影院在线免费观看| 91免费视频网| 91福利在线播放| 欧美日韩高清一区二区不卡| 色综合天天综合狠狠| 日本国产一区二区| 欧美日韩国产美女| 精品国产免费久久| 国产精品视频在线看| 亚洲欧美激情小说另类| 中文字幕中文乱码欧美一区二区 | 精品日韩一区二区三区免费视频| 欧美综合一区二区三区| 欧美嫩在线观看| 日韩免费高清视频| 久久精品一二三| 亚洲欧美电影一区二区| 精品99一区二区三区| 中文字幕在线观看不卡视频| 樱桃国产成人精品视频| 青青草成人在线观看| 国产麻豆欧美日韩一区| 久色婷婷小香蕉久久| 国产成人免费视频精品含羞草妖精| 91在线一区二区| 色网站国产精品| 91精品欧美久久久久久动漫| 久久久久久久性| 亚洲激情网站免费观看| 久久精品国产久精国产爱| 99久久精品免费看国产| 欧美午夜精品理论片a级按摩| 欧美不卡在线视频| 亚洲欧美色图小说| 国产一区二三区| 欧美在线影院一区二区| 久久综合久久综合九色| 国产视频一区在线观看| 亚洲国产精品久久久久婷婷884 | 欧美一区二区黄色| 国产欧美日产一区| 亚洲国产精品精华液网站| 免费高清在线视频一区·| 成人三级在线视频| 91精品国产综合久久香蕉的特点 | 综合分类小说区另类春色亚洲小说欧美| 亚洲一区二区三区视频在线播放 | 色香蕉久久蜜桃| 国产欧美一区二区精品忘忧草| 亚洲国产精品久久久男人的天堂| 香港成人在线视频| 国产成人日日夜夜| 精品国产乱码久久久久久浪潮| 亚洲欧美福利一区二区| 国产日产欧美一区二区三区 | 欧美在线观看禁18| 欧洲在线/亚洲| 欧美成人高清电影在线| 久久精品夜色噜噜亚洲a∨| 中文字幕欧美国产| 亚洲宅男天堂在线观看无病毒| 天堂精品中文字幕在线| 精品在线观看免费| 成人精品视频.| 色素色在线综合| 日韩一区二区中文字幕| 国产精品入口麻豆九色| 午夜欧美2019年伦理| 国产精品888| 91麻豆精品国产| 1区2区3区国产精品| 美女被吸乳得到大胸91| 91在线观看一区二区| 精品国产一区二区三区四区四| 中文字幕亚洲欧美在线不卡| 蜜桃视频一区二区三区在线观看| 国产麻豆91精品| 91精品啪在线观看国产60岁| 国产精品美女久久久久久久久久久| 午夜电影久久久| 欧美在线视频全部完| 中文字幕av一区二区三区免费看| 午夜精品久久久久久久99水蜜桃| 国产精品一二三区| 欧美一卡二卡在线| 亚洲成人av在线电影| 99久久99久久免费精品蜜臀| 久久先锋影音av鲁色资源| 美女高潮久久久| 精品少妇一区二区三区视频免付费| 亚洲成精国产精品女| 7777女厕盗摄久久久| 一区二区免费在线播放| 成人午夜激情影院| 午夜精品久久久久影视| 久久久天堂av| 欧美日本在线看| jiyouzz国产精品久久| 日韩成人一级大片| 久久久久久久综合| 欧美日韩精品一区二区| 国产福利一区二区三区视频| 香蕉成人啪国产精品视频综合网| 中文幕一区二区三区久久蜜桃| 欧美久久久久中文字幕| 91色在线porny| 免费人成黄页网站在线一区二区| 日本高清免费不卡视频| 首页亚洲欧美制服丝腿| 久久久精品国产99久久精品芒果 | 91视频在线观看免费| 青青草国产成人av片免费| 国产欧美精品一区二区三区四区| 懂色一区二区三区免费观看| 国产精品成人免费精品自在线观看|