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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? library_12.html

?? linux_c函數,linux下編程必備的
?? HTML
?? 第 1 頁 / 共 5 頁
字號:
<!-- This HTML file has been created by texi2html 1.27
     from library.texinfo on 3 March 1994 -->

<TITLE>The GNU C Library - Low-Level Input/Output</TITLE>
<P>Go to the <A HREF="library_11.html" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_11.html">previous</A>, <A HREF="library_13.html" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_13.html">next</A> section.<P>
<H1><A NAME="SEC171" HREF="library_toc.html#SEC171" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC171">Low-Level Input/Output</A></H1>
<P>
This chapter describes functions for performing low-level input/output
operations on file descriptors.  These functions include the primitives
for the higher-level I/O 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>, as
well as functions for performing low-level control operations for which
there are no equivalents on streams.
<P>
Stream-level I/O is more flexible and usually more convenient;
therefore, programmers generally use the descriptor-level functions only
when necessary.  These are some of the usual reasons:
<P>
<UL>
<LI>
For reading binary files in large chunks.
<P>
<LI>
For reading an entire file into core before parsing it.
<P>
<LI>
To perform operations other than data transfer, which can only be done
with a descriptor.  (You can use <CODE>fileno</CODE> to get the descriptor
corresponding to a stream.)
<P>
<LI>
To pass descriptors to a child process.  (The child can create its own
stream to use a descriptor that it inherits, but cannot inherit a stream
directly.)
</UL>
<P>
<H2><A NAME="SEC172" HREF="library_toc.html#SEC172" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC172">Opening and Closing Files</A></H2>
<A NAME="IDX618"></A>
<A NAME="IDX619"></A>
<P>
This section describes the primitives for opening and closing files
using file descriptors.  The <CODE>open</CODE> and <CODE>creat</CODE> functions are
declared in the header file <TT>`fcntl.h'</TT>, while <CODE>close</CODE> is
declared in <TT>`unistd.h'</TT>.
<A NAME="IDX621"></A>
<A NAME="IDX620"></A>
<P>
<A NAME="IDX622"></A>
<U>Function:</U> int <B>open</B> <I>(const char *<VAR>filename</VAR>, int <VAR>flags</VAR>[, mode_t <VAR>mode</VAR>])</I><P>
The <CODE>open</CODE> function creates and returns a new file descriptor
for the file named by <VAR>filename</VAR>.  Initially, the file position
indicator for the file is at the beginning of the file.  The argument
<VAR>mode</VAR> is used only when a file is created, but it doesn't hurt
to supply the argument in any case.
<P>
The <VAR>flags</VAR> argument controls how the file is to be opened.  This is
a bit mask; you create the value by the bitwise OR of the appropriate
parameters (using the <SAMP>`|'</SAMP> operator in C).
<P>
The <VAR>flags</VAR> argument must include exactly one of these values to
specify the file access mode:
<P>
<DL COMPACT>
<A NAME="IDX623"></A>
<DT><CODE>O_RDONLY</CODE>
<DD>Open the file for read access.
<P>
<A NAME="IDX624"></A>
<DT><CODE>O_WRONLY</CODE>
<DD>Open the file for write access.
<P>
<A NAME="IDX625"></A>
<DT><CODE>O_RDWR</CODE>
<DD>Open the file for both reading and writing.
</DL>
<P>
The <VAR>flags</VAR> argument can also include any combination of these
flags:
<P>
<DL COMPACT>
<A NAME="IDX626"></A>
<A NAME="IDX627"></A>
<DT><CODE>O_APPEND</CODE>
<DD>If set, then all <CODE>write</CODE> operations write the data at the end of
the file, extending it, regardless of the current file position.
<P>
<A NAME="IDX628"></A>
<DT><CODE>O_CREAT</CODE>
<DD>If set, the file will be created if it doesn't already exist.
<A NAME="IDX629"></A>
<P>
<A NAME="IDX630"></A>
<DT><CODE>O_EXCL</CODE>
<DD>If both <CODE>O_CREAT</CODE> and <CODE>O_EXCL</CODE> are set, then <CODE>open</CODE> fails
if the specified file already exists.
<P>
<A NAME="IDX631"></A>
<DT><CODE>O_NOCTTY</CODE>
<DD>If <VAR>filename</VAR> names a terminal device, don't make it the controlling
terminal for the process.  See section <A HREF="library_24.html#SEC411" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_24.html#SEC411">Job Control</A>, for information about what
it means to be the controlling terminal.
<P>
<A NAME="IDX632"></A>
<A NAME="IDX633"></A>
<DT><CODE>O_NONBLOCK</CODE>
<DD>This sets nonblocking mode.  This option is usually only useful for
special files such as FIFOs (see section <A HREF="library_14.html#SEC211" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_14.html#SEC211">Pipes and FIFOs</A>) and devices such
as terminals.  Normally, for these files, <CODE>open</CODE> blocks until
the file is "ready".  If <CODE>O_NONBLOCK</CODE> is set, <CODE>open</CODE>
returns immediately.
<P>
The <CODE>O_NONBLOCK</CODE> bit also affects <CODE>read</CODE> and <CODE>write</CODE>: It
permits them to return immediately with a failure status if there is no
input immediately available (<CODE>read</CODE>), or if the output can't be
written immediately (<CODE>write</CODE>).
<P>
<A NAME="IDX634"></A>
<DT><CODE>O_TRUNC</CODE>
<DD>If the file exists and is opened for write access, truncate it to zero
length.  This option is only useful for regular files, not special
files such as directories or FIFOs.
</DL>
<P>
For more information about these symbolic constants, see section <A HREF="library_12.html#SEC184" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC184">File Status Flags</A>.
<P>
The normal return value from <CODE>open</CODE> is a non-negative integer file
descriptor.  In the case of an error, a value of <CODE>-1</CODE> is returned
instead.  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>The file exists but is not readable/writable as requested by the <VAR>flags</VAR>
argument.
<P>
<DT><CODE>EEXIST</CODE>
<DD>Both <CODE>O_CREAT</CODE> and <CODE>O_EXCL</CODE> are set, and the named file already
exists.
<P>
<DT><CODE>EINTR</CODE>
<DD>The <CODE>open</CODE> operation was interrupted by a signal.
See section <A HREF="library_21.html#SEC362" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC362">Primitives Interrupted by Signals</A>.
<P>
<DT><CODE>EISDIR</CODE>
<DD>The <VAR>flags</VAR> argument specified write access, and the file is a directory.
<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.)
<P>
<DT><CODE>ENOENT</CODE>
<DD>The named file does not exist, but <CODE>O_CREAT</CODE> is not specified.
<P>
<DT><CODE>ENOSPC</CODE>
<DD>The directory or file system that would contain the new file cannot be
extended, because there is no disk space left.
<P>
<DT><CODE>ENXIO</CODE>
<DD><CODE>O_NONBLOCK</CODE> and <CODE>O_WRONLY</CODE> are both set in the <VAR>flags</VAR>
argument, the file named by <VAR>filename</VAR> is a FIFO (see section <A HREF="library_14.html#SEC211" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_14.html#SEC211">Pipes and FIFOs</A>), and no process has the file open for reading.
<P>
<DT><CODE>EROFS</CODE>
<DD>The file resides on a read-only file system and any of <CODE>O_WRONLY</CODE>,
<CODE>O_RDWR</CODE>, <CODE>O_CREAT</CODE>, and <CODE>O_TRUNC</CODE> are set in the
<VAR>flags</VAR> argument.
</DL>
<P>
The <CODE>open</CODE> function is the underlying primitive for the <CODE>fopen</CODE>
and <CODE>freopen</CODE> functions, that create streams.
<P>
<A NAME="IDX635"></A>
<U>Obsolete function:</U> int <B>creat</B> <I>(const char *<VAR>filename</VAR>, mode_t <VAR>mode</VAR>)</I><P>
This function is obsolete.  The call
<P>
<PRE>
creat (<VAR>filename</VAR>, <VAR>mode</VAR>)
</PRE>
<P>
is equivalent to
<P>
<PRE>
open (<VAR>filename</VAR>, O_WRONLY | O_CREAT | O_TRUNC, <VAR>mode</VAR>)
</PRE>
<P>
<A NAME="IDX636"></A>
<U>Function:</U> int <B>close</B> <I>(int <VAR>filedes</VAR>)</I><P>
The function <CODE>close</CODE> closes the file descriptor <VAR>filedes</VAR>.
Closing a file has the following consequences:
<P>
<UL>
<LI>
The file descriptor is deallocated.
<P>
<LI>
Any record locks owned by the process on the file are unlocked.
<P>
<LI>
When all file descriptors associated with a pipe or FIFO have been closed,
any unread data is discarded.
</UL>
<P>
The normal return value from <CODE>close</CODE> is <CODE>0</CODE>; a value of <CODE>-1</CODE>
is returned in case of failure.  The following <CODE>errno</CODE> error
conditions are defined for this function:
<P>
<DL COMPACT>
<DT><CODE>EBADF</CODE>
<DD>The <VAR>filedes</VAR> argument is not a valid file descriptor.
<P>
<DT><CODE>EINTR</CODE>
<DD>The call was interrupted by a signal.  See section <A HREF="library_21.html#SEC362" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC362">Primitives Interrupted by Signals</A>.
Here's an example of how to handle <CODE>EINTR</CODE> properly:
<P>
<PRE>
TEMP_FAILURE_RETRY (close (desc));
</PRE>
</DL>
<P>
To close a stream, call <CODE>fclose</CODE> (see section <A HREF="library_11.html#SEC121" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_11.html#SEC121">Closing Streams</A>) instead
of trying to close its underlying file descriptor with <CODE>close</CODE>.
This flushes any buffered output and updates the stream object to
indicate that it is closed.
<P>
<H2><A NAME="SEC173" HREF="library_toc.html#SEC173" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC173">Input and Output Primitives</A></H2>
<P>
This section describes the functions for performing primitive input and
output operations on file descriptors: <CODE>read</CODE>, <CODE>write</CODE>, and
<CODE>lseek</CODE>.  These functions are declared in the header file
<TT>`unistd.h'</TT>.
<A NAME="IDX637"></A>
<P>
<A NAME="IDX638"></A>
<U>Data Type:</U> <B>ssize_t</B><P>
This data type is used to represent the sizes of blocks that can be
read or written in a single operation.  It is similar to <CODE>size_t</CODE>,
but must be a signed type.
<P>
<A NAME="IDX639"></A>
<P>
<A NAME="IDX640"></A>
<U>Function:</U> ssize_t <B>read</B> <I>(int <VAR>filedes</VAR>, void *<VAR>buffer</VAR>, size_t <VAR>size</VAR>)</I><P>
The <CODE>read</CODE> function reads up to <VAR>size</VAR> bytes from the file
with descriptor <VAR>filedes</VAR>, storing the results in the <VAR>buffer</VAR>.
(This is not necessarily a character string and there is no terminating
null character added.)
<A NAME="IDX641"></A>
<P>
The return value is the number of bytes actually read.  This might be
less than <VAR>size</VAR>; for example, if there aren't that many bytes left
in the file or if there aren't that many bytes immediately available.
The exact behavior depends on what kind of file it is.  Note that
reading less than <VAR>size</VAR> bytes is not an error.
<P>
A value of zero indicates end-of-file (except if the value of the
<VAR>size</VAR> argument is also zero).  This is not considered an error.
If you keep calling <CODE>read</CODE> while at end-of-file, it will keep
returning zero and doing nothing else.
<P>
If <CODE>read</CODE> returns at least one character, there is no way you can
tell whether end-of-file was reached.  But if you did reach the end, the
next read will return zero.
<P>
In case of an error, <CODE>read</CODE> returns <CODE>-1</CODE>.  The following
<CODE>errno</CODE> error conditions are defined for this function:
<P>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产999精品久久| 91精品国产aⅴ一区二区| 欧美日韩一区视频| 中文字幕免费观看一区| 亚洲一区二区三区三| 国产一区二区三区美女| 欧美日本高清视频在线观看| 日韩理论在线观看| 国产不卡视频在线观看| 337p亚洲精品色噜噜噜| 亚洲女爱视频在线| 国产 欧美在线| 久久无码av三级| 奇米影视一区二区三区| 欧美日韩一区在线| 亚洲精品视频观看| 99精品国产热久久91蜜凸| 国产亚洲精久久久久久| 久久精品久久综合| 欧美群妇大交群的观看方式| 综合在线观看色| 99r精品视频| 亚洲欧美在线观看| 成人性色生活片免费看爆迷你毛片| 日韩色在线观看| 日韩av不卡在线观看| 欧美三级一区二区| 亚洲亚洲精品在线观看| 在线亚洲+欧美+日本专区| 国产精品麻豆99久久久久久| 懂色av中文一区二区三区| 精品粉嫩超白一线天av| 国内精品伊人久久久久av影院| 日韩欧美一级精品久久| 经典三级在线一区| 久久久精品国产免费观看同学| 国产一区二区三区国产| 久久午夜色播影院免费高清| 国产精品资源网| 日本一区二区不卡视频| 成人国产精品免费观看| 亚洲婷婷综合久久一本伊一区| 91在线观看视频| 亚洲综合小说图片| 在线不卡a资源高清| 蜜桃视频一区二区三区| 久久亚洲精精品中文字幕早川悠里| 国产最新精品免费| 国产精品高潮久久久久无| 色综合天天性综合| 午夜av一区二区三区| 日韩精品一区二区三区四区| 国产精品88888| 亚洲欧美另类久久久精品| 在线免费观看日韩欧美| 蜜臀91精品一区二区三区| 国产亚洲欧美激情| 在线免费观看不卡av| 热久久国产精品| 久久男人中文字幕资源站| 成人国产一区二区三区精品| 亚洲在线视频免费观看| 欧美电影免费观看高清完整版在线观看 | 国产91综合网| 亚洲卡通欧美制服中文| 欧美一区二区黄色| 成人精品一区二区三区四区 | 在线电影欧美成精品| 国产成人在线免费| 亚洲午夜日本在线观看| 337p日本欧洲亚洲大胆精品| 99国产欧美另类久久久精品| 婷婷开心激情综合| 国产欧美日韩久久| 欧美日韩一区二区三区免费看| 国精品**一区二区三区在线蜜桃| 亚洲欧美视频一区| 337p粉嫩大胆噜噜噜噜噜91av| 91丨九色丨蝌蚪富婆spa| 久久精品国产精品亚洲精品| 夜色激情一区二区| 久久蜜桃一区二区| 欧美亚洲一区二区在线| 岛国av在线一区| 免播放器亚洲一区| 亚洲一区二区三区视频在线播放| 久久网站热最新地址| 欧美人牲a欧美精品| av男人天堂一区| 另类小说视频一区二区| 亚洲一区二区三区国产| 中文字幕国产精品一区二区| 精品欧美一区二区在线观看| 欧美色手机在线观看| 99麻豆久久久国产精品免费| 国产一区二区三区在线观看免费视频 | 国产精品国产a| 精品国产免费一区二区三区四区 | 国产精品影视在线| 天堂成人免费av电影一区| 国产精品久久久久久户外露出| 欧美白人最猛性xxxxx69交| 日本精品一级二级| 99精品视频中文字幕| 懂色av一区二区夜夜嗨| 国产一区二区福利| 国产一区二区三区精品视频| 麻豆视频一区二区| 青青草原综合久久大伊人精品| 亚洲线精品一区二区三区八戒| 成人免费视频在线观看| 国产精品剧情在线亚洲| 国产视频一区二区在线| 国产午夜精品久久| 国产亚洲自拍一区| 国产精品视频在线看| 国产喷白浆一区二区三区| 久久精品夜色噜噜亚洲a∨| 久久综合五月天婷婷伊人| 2023国产精品| 国产日韩欧美制服另类| 国产精品免费视频观看| 亚洲欧美色一区| 亚洲大片精品永久免费| 亚洲成av人片一区二区三区| 首页国产欧美久久| 日本欧美大码aⅴ在线播放| 日本不卡123| 国产综合久久久久影院| 丁香啪啪综合成人亚洲小说| av网站一区二区三区| 欧美优质美女网站| 91精品婷婷国产综合久久性色| 日韩一级大片在线观看| 国产日韩欧美亚洲| 亚洲欧美日韩成人高清在线一区| 亚洲成人精品一区| 久久国产综合精品| 成人免费视频视频在线观看免费 | 成人黄色软件下载| 欧美亚洲愉拍一区二区| 欧美成人三级在线| 中文字幕av一区二区三区免费看 | 久久女同精品一区二区| 中文字幕日韩一区| 日韩成人精品视频| 国产91精品露脸国语对白| 色猫猫国产区一区二在线视频| 91精品国产高清一区二区三区| 久久久欧美精品sm网站| 亚洲最大成人综合| 激情图片小说一区| 色婷婷久久久久swag精品 | 另类小说视频一区二区| jlzzjlzz亚洲日本少妇| 9191国产精品| 国产精品少妇自拍| 日本不卡一二三区黄网| 成人va在线观看| 日韩欧美你懂的| 亚洲欧美日韩小说| 韩国一区二区视频| 欧美日韩你懂的| 国产精品情趣视频| 麻豆成人久久精品二区三区小说| 99久久国产综合精品麻豆| 日韩三级在线观看| 一区二区免费视频| 国产高清久久久| 欧美日韩www| 亚洲视频资源在线| 懂色av一区二区夜夜嗨| 精品人在线二区三区| 日韩精品免费专区| 日本精品视频一区二区| 国产日本亚洲高清| 黑人精品欧美一区二区蜜桃| 欧美日本一道本| 亚洲主播在线观看| www.亚洲在线| 国产精品午夜在线观看| 国产精品一线二线三线| 日韩女优毛片在线| 三级影片在线观看欧美日韩一区二区| 99国产精品视频免费观看| 欧美国产日韩亚洲一区| 激情综合一区二区三区| 欧美一级午夜免费电影| 日韩在线播放一区二区| 欧美曰成人黄网| 亚洲精品ww久久久久久p站| 99久久婷婷国产综合精品 | 久久久99精品免费观看| 麻豆国产一区二区| 欧美va亚洲va香蕉在线| 六月丁香婷婷色狠狠久久| 欧美videos中文字幕| 伦理电影国产精品| 精品88久久久久88久久久| 精品一区二区三区视频在线观看|