FFLUSH(3) BSD Programmer's Manual FFLUSH(3) NNAAMMEE fffflluusshh, ffppuurrggee - flush a stream SSYYNNOOPPSSIISS ##iinncclluuddee <<ssttddiioo..hh>> _i_n_t fffflluusshh(_F_I_L_E _*_s_t_r_e_a_m); _i_n_t ffppuurrggee(_F_I_L_E _*_s_t_r_e_a_m); DDEESSCCRRIIPPTTIIOONN The function fffflluusshh() forces a write of all buffered data for the given output or update _s_t_r_e_a_m via the stream's underlying write function. The open status of the stream is unaffected. If the _s_t_r_e_a_m argument is NULL, fffflluusshh() flushes _a_l_l open output streams. The function ffppuurrggee() erases any input or output buffered in the given _s_t_r_e_a_m. For output streams this discards any unwritten output. For input streams this discards any input read from the underlying object but not yet obtained via getc(3); this includes any text pushed back via ungetc. RREETTUURRNN VVAALLUUEESS Upon successful completion 0 is returned. Otherwise, EOF is returned and the global variable _e_r_r_n_o is set to indicate the error. EERRRROORRSS [EBADF] _S_t_r_e_a_m is not an open stream, or, in the case of fffflluusshh(), not a stream open for writing. The function fffflluusshh() may also fail and set _e_r_r_n_o for any of the errors specified for the routine write(2). SSEEEE AALLSSOO write(2), fopen(3), fclose(3), setbuf(3) SSTTAANNDDAARRDDSS The fffflluusshh() function conforms to ANSI C X3.159-1989 (``ANSI C ''). 4.4BSD June 4, 1993 1