⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setvbuf.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>setvbuf</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_008_516">&nbsp;</a>NAME</h4><blockquote>setvbuf - assign buffering to a stream</blockquote><h4><a name = "tag_000_008_517">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>#include &lt;<a href="stdio.h.html">stdio.h</a>&gt;int setvbuf(FILE *<i>stream</i>, char *<i>buf</i>, int <i>type</i>, size_t <i>size</i>);</code></pre></blockquote><h4><a name = "tag_000_008_518">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>setvbuf()</i>function may be used after the stream pointed to by<i>stream</i>is associated with an open file but before any otheroperation is performed on the stream.The argument<i>type</i>determines how<i>stream</i>will be buffered, as follows:_IOFBF causes input/output to be fully buffered;_IOLBF causes input/output to be line buffered;_IONBF causes input/output to be unbuffered.If<i>buf</i>is not a null pointer, the array it points to may be used insteadof a buffer allocated by<i>setvbuf()</i>.The argument<i>size</i>specifies the size of the array.The contents of the array at any time are indeterminate.<p>For information about streams, see<a href="stdio.html">Standard I/O Streans</a>.</blockquote><h4><a name = "tag_000_008_519">&nbsp;</a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>setvbuf()</i>returns 0.  Otherwise, it returns a non-zero value if an invalid value isgiven for<i>type</i>or if the request cannot be honoured.</blockquote><h4><a name = "tag_000_008_520">&nbsp;</a>ERRORS</h4><blockquote>The<i>setvbuf()</i>function may fail if:<dl compact><dt>[EBADF]<dd>The file descriptor underlying<i>stream</i>is not valid.</dl></blockquote><h4><a name = "tag_000_008_521">&nbsp;</a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_008_522">&nbsp;</a>APPLICATION USAGE</h4><blockquote>A common source of error is allocating buffer spaceas an &quot;automatic&quot; variable in a code block, and thenfailing to close the stream in the same block.<p>With<i>setvbuf()</i>,allocating a buffer of<i>size</i>bytes does not necessarily imply that all of<i>size</i>bytes are used for the buffer area.<p>Applications should note that many implementations only provide linebuffering on input from terminal devices.</blockquote><h4><a name = "tag_000_008_523">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_008_524">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="fopen.html">fopen()</a></i>,<i><a href="setbuf.html">setbuf()</a></i>,<i><a href="stdio.h.html">&lt;stdio.h&gt;</a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from Issue 1 of the SVID.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 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 + -