1FCLOSE(3)                  Linux Programmer's Manual                 FCLOSE(3)
2
3
4

NAME

6       fclose - close a stream
7

SYNOPSIS

9       #include <stdio.h>
10
11       int fclose(FILE *fp);
12

DESCRIPTION

14       The fclose() function will flushes the stream pointed to by fp (writing
15       any buffered output data using fflush(3))  and  closes  the  underlying
16       file descriptor.
17

RETURN VALUE

19       Upon  successful  completion 0 is returned.  Otherwise, EOF is returned
20       and errno is set to indicate the error.  In  either  case  any  further
21       access  (including  another  call to fclose()) to the stream results in
22       undefined behavior.
23

ERRORS

25       EBADF  The file descriptor underlying fp is not valid.
26
27       The fclose() function may also fail and set errno for any of the errors
28       specified for the routines close(2), write(2) or fflush(3).
29

CONFORMING TO

31       C89, C99.
32

NOTES

34       Note  that fclose() only flushes the user space buffers provided by the
35       C library.  To ensure that the data is physically stored  on  disk  the
36       kernel  buffers  must  be  flushed  too,  for  example, with sync(2) or
37       fsync(2).
38

SEE ALSO

40       close(2), fcloseall(3), fflush(3), fopen(3), setbuf(3)
41

COLOPHON

43       This page is part of release 3.25 of the Linux  man-pages  project.   A
44       description  of  the project, and information about reporting bugs, can
45       be found at http://www.kernel.org/doc/man-pages/.
46
47
48
49GNU                               2009-02-23                         FCLOSE(3)
Impressum