.\" Chris Torek and the American National Standards Committee X3,
.\" on Information Processing Systems.
.\"
+.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
+.\" %%%LICENSE_END
.\"
.\" @(#)fclose.3 6.7 (Berkeley) 6/29/91
.\"
.\" Converted for Linux, Mon Nov 29 15:19:14 1993, faith@cs.unc.edu
.\"
-.\" Modified 2000-07-22 by Nicolás Lichtmaier <nick@debian.org>
+.\" Modified 2000-07-22 by Nicolás Lichtmaier <nick@debian.org>
.\"
-.TH FCLOSE 3 2009-02-23 "GNU" "Linux Programmer's Manual"
+.TH FCLOSE 3 2015-01-22 "GNU" "Linux Programmer's Manual"
.SH NAME
fclose \- close a stream
.SH SYNOPSIS
.B #include <stdio.h>
.sp
-.BI "int fclose(FILE *" fp );
+.BI "int fclose(FILE *" stream );
.SH DESCRIPTION
The
.BR fclose ()
function flushes the stream pointed to by
-.I fp
+.I stream
(writing any buffered output data using
.BR fflush (3))
and closes the underlying file descriptor.
-.SH "RETURN VALUE"
+.SH RETURN VALUE
Upon successful completion 0 is returned.
Otherwise,
.B EOF
.TP
.B EBADF
The file descriptor underlying
-.I fp
+.I stream
is not valid.
.\" This error cannot occur unless you are mixing ANSI C stdio operations and
.\" low-level file operations on the same stream. If you do get this error,
.\" you must have closed the stream's low-level file descriptor using
-.\" something like close(fileno(fp)).
+.\" something like close(fileno(stream)).
.PP
The
.BR fclose ()
.BR write (2)
or
.BR fflush (3).
-.SH "CONFORMING TO"
+.SH CONFORMING TO
C89, C99.
.SH NOTES
Note that
.BR fclose ()
-only flushes the user space buffers provided by the
+flushes only the user-space buffers provided by the
C library.
To ensure that the data is physically stored
on disk the kernel buffers must be flushed too, for example, with
.BR sync (2)
or
.BR fsync (2).
-.SH "SEE ALSO"
+.SH SEE ALSO
.BR close (2),
.BR fcloseall (3),
.BR fflush (3),
.BR fopen (3),
.BR setbuf (3)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.