570
|
1 <refentry id="fclose">
|
|
2 <refnamediv>
|
|
3 <refname>Fclose</refname>
|
|
4 <refname>Fflush</refname>
|
|
5 <refpurpose>flush or close a file</refpurpose>
|
|
6 </refnamediv>
|
|
7
|
|
8 <refsynopsisdiv>
|
|
9 <funcsynopsis>
|
|
10 <funcsynopsisinfo>
|
|
11 #include <stdio.h>
|
|
12 </funcsynopsisinfo>
|
|
13
|
|
14 <funcprototype>
|
|
15 <funcdef><function>fclose</function></funcdef>
|
|
16 <paramdef>FILE *<parameter>fp</parameter></paramdef>
|
|
17 </funcprototype>
|
|
18
|
|
19 <funcprototype>
|
|
20 <funcdef><function>fflush</function></funcdef>
|
|
21 <paramdef>FILE *<parameter>fp</parameter></paramdef>
|
|
22 </funcprototype>
|
|
23
|
|
24 </funcsynopsis>
|
|
25
|
|
26 </refsynopsisdiv>
|
|
27
|
|
28 <refsect1><title>Description</title>
|
|
29 <para>
|
594
|
30 Fflush causes a buffer associated with the file pointer "fp"
|
|
31 to be cleared by writing out to the file; of course, only if
|
|
32 the file was opened for write or update. It is not normally
|
|
33 ncesasary to call fflush, but it can be useful when, for
|
|
34 example, normal output is to "stdout", and it is wished to
|
|
35 send something to "stderr" which is unbuffered. If fflush
|
|
36 were not used and "stdout" referred to the terminal, the
|
|
37 "stderr" message will appear before large chunks of the
|
|
38 "stdout" message even though the latter was written first.
|
|
39 </para>
|
|
40 <para>
|
|
41 Fclose call fflush to clear out the buffer associated with
|
|
42 "fp", closes the file, and frees the buffer for use by another
|
|
43 fopen call.
|
|
44 </para>
|
|
45 <para>
|
|
46 The exit() system call and normal termination of a program
|
|
47 causes fclose to be called for each open file.
|
570
|
48 </para>
|
|
49 </refsect1>
|
594
|
50
|
|
51 <refsect1><title>See Also</title>
|
|
52 <para>
|
|
53 System call
|
|
54 <link linkend="close">close()</link>,
|
|
55 <link linkend="fopen">fopen()</link>,
|
|
56 <link linkend="setbuf">setbuf()</link>.
|
|
57 </para>
|
|
58 </refsect1>
|
|
59
|
570
|
60 <refsect1><title>Diagnostics</title>
|
|
61 <para>
|
|
62 EOF is returned if "fp" does not refer to an output file or
|
|
63 there is an error writing to the file.
|
|
64 </para>
|
|
65 </refsect1>
|
|
66
|
|
67 </refentry>
|