2.9BSD/usr/man/cat3/setbuf.3s


SETBUF(3S)          UNIX Programmer's Manual           SETBUF(3S)

NAME
     setbuf - assign buffering to a stream

SYNOPSIS
     #include <stdio.h>

     setbuf(stream, buf)
     FILE *stream;
     char *buf;

DESCRIPTION
     _S_e_t_b_u_f is used after a stream has been opened but before it
     is read or written.  It causes the character array _b_u_f to be
     used instead of an automatically allocated buffer.  If _b_u_f
     is the constant pointer NULL, input/output will be com-
     pletely unbuffered.

     A manifest constant BUFSIZ tells how big an array is needed:

          char buf[BUFSIZ];

     A buffer is normally obtained from _m_a_l_l_o_c(3) upon the first
     _g_e_t_c or _p_u_t_c(3S) on the file, except that the standard out-
     put is line buffered when directed to a terminal.  Other
     output streams directed to terminals, and the standard error
     stream _s_t_d_e_r_r are normally not buffered.  If the standard
     output is line buffered, then it is flushed each time data
     are read from the standard input by _r_e_a_d(2).

SEE ALSO
     fopen(3S), getc(3S), malloc(3), putc(3S)

BUGS
     The standard error stream should be line buffered by
     default.

Printed 5/17/83                                                 1