1<html lang="en"> 2<head> 3<title>setbuffer - 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="setbuf.html#setbuf" title="setbuf"> 10<link rel="next" href="setlinebuf.html#setlinebuf" title="setlinebuf"> 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="setbuffer"></a> 29<p> 30Next: <a rel="next" accesskey="n" href="setlinebuf.html#setlinebuf">setlinebuf</a>, 31Previous: <a rel="previous" accesskey="p" href="setbuf.html#setbuf">setbuf</a>, 32Up: <a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a> 33<hr> 34</div> 35 36<h3 class="section">4.55 <code>setbuffer</code>—specify full buffering for a file or stream with size</h3> 37 38<p><a name="index-setbuffer-264"></a><strong>Synopsis</strong> 39<pre class="example"> #include <stdio.h> 40 void setbuffer(FILE *<var>fp</var>, char *<var>buf</var>, int <var>size</var>); 41 42</pre> 43 <p><strong>Description</strong><br> 44<code>setbuffer</code> specifies that output to the file or stream identified by 45<var>fp</var> should be fully buffered. All output for this file will go to a 46buffer (of size <var>size</var>). Output will be passed on to the host system 47only when the buffer is full, or when an input operation intervenes. 48 49 <p>You may, if you wish, supply your own buffer by passing a pointer to 50it as the argument <var>buf</var>. It must have size <var>size</var>. You can 51also use <code>NULL</code> as the value of <var>buf</var>, to signal that the 52<code>setbuffer</code> function is to allocate the buffer. 53 54 <p><br> 55<strong>Warnings</strong><br> 56You may only use <code>setbuffer</code> before performing any file operation 57other than opening the file. 58 59 <p>If you supply a non-null <var>buf</var>, you must ensure that the associated 60storage continues to be available until you close the stream 61identified by <var>fp</var>. 62 63 <p><br> 64<strong>Returns</strong><br> 65<code>setbuffer</code> does not return a result. 66 67 <p><br> 68<strong>Portability</strong><br> 69This function comes from BSD not ANSI or POSIX. 70 71 <p>Supporting OS subroutines required: <code>close</code>, <code>fstat</code>, <code>isatty</code>, 72<code>lseek</code>, <code>read</code>, <code>sbrk</code>, <code>write</code>. 73 74 <p><br> 75 76 </body></html> 77 78