Commit | Line | Data |
---|---|---|
639aed4c KB |
1 | .\" Copyright (c) 1990 The Regents of the University of California. |
2 | .\" All rights reserved. | |
22f1f128 | 3 | .\" |
639aed4c KB |
4 | .\" This code is derived from software contributed to Berkeley by |
5 | .\" Chris Torek. | |
6 | .\" | |
7 | .\" %sccs.include.redist.man% | |
8 | .\" | |
b07885fe | 9 | .\" @(#)fclose.3 6.5 (Berkeley) %G% |
639aed4c KB |
10 | .\" |
11 | .TH FCLOSE 3 "" | |
12 | .UC 7 | |
22f1f128 | 13 | .SH NAME |
639aed4c | 14 | fclose \- close a stream |
22f1f128 | 15 | .SH SYNOPSIS |
639aed4c KB |
16 | .nf |
17 | .ft B | |
18 | #include <stdio.h> | |
19 | ||
20 | int | |
21 | fclose(FILE *stream); | |
22 | .ft R | |
23 | .fi | |
22f1f128 KM |
24 | .SH DESCRIPTION |
25 | .I Fclose | |
639aed4c | 26 | dissociates the named |
e6ecb2ae | 27 | .I stream |
639aed4c KB |
28 | from its underlying file or set of functions. |
29 | If the stream was being used for output, any buffered data is written | |
30 | first, using | |
31 | .IR fflush (3). | |
639aed4c KB |
32 | .SH "RETURN VALUE" |
33 | Upon successful completion 0 is returned. | |
34 | Otherwise, | |
22f1f128 | 35 | .B EOF |
639aed4c KB |
36 | is returned and the global variable |
37 | .I errno | |
38 | is set to indicate the error. | |
39 | In either case no further access to the stream is possible. | |
40 | .SH ERRORS | |
41 | .TP 15 | |
42 | [EBADF] | |
43 | .I Stream | |
44 | is not an open stream. | |
45 | .PP | |
46 | .I Fclose | |
47 | may also fail and set | |
48 | .I errno | |
49 | for any of the errors specified for the routines | |
50 | .IR close (2) | |
51 | or | |
52 | .IR fflush (3). | |
53 | .SH STANDARDS | |
54 | .I Fclose | |
55 | conforms to ANSI X3.159-1989 (``ANSI C''). | |
b07885fe KB |
56 | .SH "SEE ALSO" |
57 | close(2), fflush(3), fopen(3), setbuf(3) |