• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/libc/
1<html lang="en">
2<head>
3<title>setvbuf - Untitled</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Untitled">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Stdio.html#Stdio" title="Stdio">
9<link rel="prev" href="setlinebuf.html#setlinebuf" title="setlinebuf">
10<link rel="next" href="siprintf.html#siprintf" title="siprintf">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<meta http-equiv="Content-Style-Type" content="text/css">
13<style type="text/css"><!--
14  pre.display { font-family:inherit }
15  pre.format  { font-family:inherit }
16  pre.smalldisplay { font-family:inherit; font-size:smaller }
17  pre.smallformat  { font-family:inherit; font-size:smaller }
18  pre.smallexample { font-size:smaller }
19  pre.smalllisp    { font-size:smaller }
20  span.sc    { font-variant:small-caps }
21  span.roman { font-family:serif; font-weight:normal; } 
22  span.sansserif { font-family:sans-serif; font-weight:normal; } 
23--></style>
24<link rel="stylesheet" type="text/css" href="../cs.css">
25</head>
26<body>
27<div class="node">
28<a name="setvbuf"></a>
29<p>
30Next:&nbsp;<a rel="next" accesskey="n" href="siprintf.html#siprintf">siprintf</a>,
31Previous:&nbsp;<a rel="previous" accesskey="p" href="setlinebuf.html#setlinebuf">setlinebuf</a>,
32Up:&nbsp;<a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a>
33<hr>
34</div>
35
36<h3 class="section">4.57 <code>setvbuf</code>&mdash;specify file or stream buffering</h3>
37
38<p><a name="index-setvbuf-266"></a><strong>Synopsis</strong>
39<pre class="example">     #include &lt;stdio.h&gt;
40     int setvbuf(FILE *<var>fp</var>, char *<var>buf</var>,
41         int <var>mode</var>, size_t <var>size</var>);
42     
43</pre>
44   <p><strong>Description</strong><br>
45Use <code>setvbuf</code> to specify what kind of buffering you want for the
46file or stream identified by <var>fp</var>, by using one of the following
47values (from <code>stdio.h</code>) as the <var>mode</var> argument:
48
49     <dl>
50<dt><code>_IONBF</code><dd>Do not use a buffer: send output directly to the host system for the
51file or stream identified by <var>fp</var>.
52
53     <br><dt><code>_IOFBF</code><dd>Use full output buffering: output will be passed on to the host system
54only when the buffer is full, or when an input operation intervenes.
55
56     <br><dt><code>_IOLBF</code><dd>Use line buffering: pass on output to the host system at every
57newline, as well as when the buffer is full, or when an input
58operation intervenes. 
59</dl>
60
61   <p>Use the <var>size</var> argument to specify how large a buffer you wish.  You
62can supply the buffer itself, if you wish, by passing a pointer to a
63suitable area of memory as <var>buf</var>.  Otherwise, you may pass <code>NULL</code>
64as the <var>buf</var> argument, and <code>setvbuf</code> will allocate the buffer.
65
66   <p><br>
67<strong>Warnings</strong><br>
68You may only use <code>setvbuf</code> before performing any file operation other
69than opening the file.
70
71   <p>If you supply a non-null <var>buf</var>, you must ensure that the associated
72storage continues to be available until you close the stream
73identified by <var>fp</var>.
74
75   <p><br>
76<strong>Returns</strong><br>
77A <code>0</code> result indicates success, <code>EOF</code> failure (invalid <var>mode</var> or
78<var>size</var> can cause failure).
79
80   <p><br>
81<strong>Portability</strong><br>
82Both ANSI C and the System V Interface Definition (Issue 2) require
83<code>setvbuf</code>. However, they differ on the meaning of a <code>NULL</code> buffer
84pointer: the SVID issue 2 specification says that a <code>NULL</code> buffer
85pointer requests unbuffered output.  For maximum portability, avoid
86<code>NULL</code> buffer pointers.
87
88   <p>Both specifications describe the result on failure only as a
89nonzero value.
90
91   <p>Supporting OS subroutines required: <code>close</code>, <code>fstat</code>, <code>isatty</code>,
92<code>lseek</code>, <code>read</code>, <code>sbrk</code>, <code>write</code>.
93
94   <p><br>
95
96   </body></html>
97
98