blob: 034f375ff9fb0d87aca4b1ebd81105ae052daf85 [file]
<html lang="en">
<head>
<title>fpurge - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Stdio.html#Stdio" title="Stdio">
<link rel="prev" href="fopencookie.html#fopencookie" title="fopencookie">
<link rel="next" href="fputc.html#fputc" title="fputc">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="fpurge"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="fputc.html#fputc">fputc</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="fopencookie.html#fopencookie">fopencookie</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a>
<hr>
</div>
<h3 class="section">4.19 <code>fpurge</code>&mdash;discard pending file I/O</h3>
<p><a name="index-fpurge-181"></a><a name="index-g_t_005ffpurge_005fr-182"></a><a name="index-g_t_005f_005ffpurge-183"></a><strong>Synopsis</strong>
<pre class="example"> #include &lt;stdio.h&gt;
int fpurge(FILE *<var>fp</var>);
int _fpurge_r(struct _reent *<var>reent</var>, FILE *<var>fp</var>);
#include &lt;stdio.h&gt;
#include &lt;stdio_ext.h&gt;
void __fpurge(FILE *<var>fp</var>);
</pre>
<p><strong>Description</strong><br>
Use <code>fpurge</code> to clear all buffers of the given stream. For output
streams, this discards data not yet written to disk. For input streams,
this discards any data from <code>ungetc</code> and any data retrieved from disk
but not yet read via <code>getc</code>. This is more severe than <code>fflush</code>,
and generally is only needed when manually altering the underlying file
descriptor of a stream.
<p><code>__fpurge</code> behaves exactly like <code>fpurge</code> but does not return a value.
<p>The alternate function <code>_fpurge_r</code> is a reentrant version, where the
extra argument <var>reent</var> is a pointer to a reentrancy structure, and
<var>fp</var> must not be NULL.
<p><br>
<strong>Returns</strong><br>
<code>fpurge</code> returns <code>0</code> unless <var>fp</var> is not valid, in which case it
returns <code>EOF</code> and sets <code>errno</code>.
<p><br>
<strong>Portability</strong><br>
These functions are not portable to any standard.
<p>No supporting OS subroutines are required.
<p><br>
</body></html>