Commit | Line | Data |
---|---|---|
48ffd455 KB |
1 | .\" Copyright (c) 1990 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" This code is derived from software contributed to Berkeley by | |
5 | .\" Chris Torek. | |
6 | .\" | |
7 | .\" %sccs.include.redist.man% | |
8 | .\" | |
9 | .\" @(#)fflush.3 5.1 (Berkeley) %G% | |
10 | .\" | |
11 | .TH FFLUSH 3 "" | |
12 | .UC 7 | |
13 | .SH NAME | |
14 | fflush, fpurge \- flush a stream | |
15 | .SH SYNOPSIS | |
16 | .nf | |
17 | .ft B | |
18 | #include <stdio.h> | |
19 | ||
20 | int | |
21 | fflush(FILE *stream); | |
22 | ||
23 | int | |
24 | fpurge(FILE *stream); | |
25 | .ft R | |
26 | .fi | |
27 | .SH DESCRIPTION | |
28 | .I Fflush | |
29 | writes any buffered data for the given output | |
30 | .I stream | |
31 | via the stream's underlying write function. | |
32 | The stream remains open. | |
33 | .PP | |
34 | If the | |
35 | .I stream | |
36 | argument is NULL, | |
37 | .I fflush | |
38 | flushes | |
39 | .I all | |
40 | open output streams. | |
41 | .PP | |
42 | .I Fpurge | |
43 | erases any input or output buffered in the given | |
44 | .IR stream . | |
45 | For output streams this discards any unwritten output. | |
46 | For input streams this discards any input read from the underlying object | |
47 | but not yet obtained via | |
48 | .IR getc ; | |
49 | this includes any text pushed back via | |
50 | .IR ungetc . | |
51 | .SH "RETURN VALUE" | |
52 | Upon successful completion 0 is returned. | |
53 | Otherwise, | |
54 | .B EOF | |
55 | is returned and the global variable | |
56 | .I errno | |
57 | is set to indicate the error. | |
58 | .SH ERRORS | |
59 | .TP 15 | |
60 | [EBADF] | |
61 | .I Stream | |
62 | is not an open stream, or, in the case of | |
63 | .IR fflush , | |
64 | not a stream open for writing. | |
65 | .PP | |
66 | .I Fflush | |
67 | may also fail and set | |
68 | .I errno | |
69 | for any of the errors specified for the routine | |
70 | .IR write (2). | |
71 | .SH "SEE ALSO" | |
72 | write(2), fopen(3), fclose(3), setbuf(3) | |
73 | .SH STANDARDS | |
74 | .I Fflush | |
75 | conforms to ANSI X3.159-1989 (``ANSI C''). |