view docs/ccguide/fclose.refentry @ 3250:13737f3608e6

Updated Level 1 VTIO and CoVDG for updates to do CoCoVGA. Updated Level 1 CoCo1 area makefile's to produce binaries and disk images needed for the CoCoVGA video output.
author David Ladd <drencor-xeen@users.sourceforge.net>
date Wed, 28 Mar 2018 21:20:31 -0500 (2018-03-29)
parents c0da1728ed5b
children
line wrap: on
line source
<refentry id="fclose">
<refnamediv>
<refname>Fclose</refname>
<refname>Fflush</refname>
<refpurpose>flush or close a file</refpurpose>
</refnamediv>

<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>
#include &lt;stdio.h&gt;
</funcsynopsisinfo>

<funcprototype>
  <funcdef><function>fclose</function></funcdef>
  <paramdef>FILE *<parameter>fp</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef><function>fflush</function></funcdef>
  <paramdef>FILE *<parameter>fp</parameter></paramdef>
</funcprototype>

</funcsynopsis>

</refsynopsisdiv>

<refsect1><title>Description</title>
<para>
Fflush causes a buffer associated with the file pointer "fp"
to be cleared by writing out to the file; of course, only if
the file was opened for write or update. It is not normally
ncesasary to call fflush, but it can be useful when, for
example, normal output is to "stdout", and it is wished to
send something to "stderr" which is unbuffered. If fflush
were not used and "stdout" referred to the terminal, the
"stderr" message will appear before large chunks of the
"stdout" message even though the latter was written first.
</para>
<para>
Fclose call fflush to clear out the buffer associated with
"fp", closes the file, and frees the buffer for use by another
fopen call.
</para>
<para>
The exit() system call and normal termination of a program
causes fclose to be called for each open file.
</para>
</refsect1>

<refsect1><title>See Also</title>
<para>
System call
<link linkend="close">close()</link>,
<link linkend="fopen">fopen()</link>,
<link linkend="setbuf">setbuf()</link>.
</para>
</refsect1>

<refsect1><title>Diagnostics</title>
<para>
EOF is returned if "fp" does not refer to an output file or
there is an error writing to the file.
</para>
</refsect1>

</refentry>