man(1) Manual page archive


     SETBUF(3S)                                             SETBUF(3S)

     NAME
          setbuf - assign buffering to a stream

     SYNOPSIS
          #include <stdio.h>

          setbuf(stream, buf)
          FILE *stream;
          char buf[BUFSIZ];

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

          A buffer is normally obtained from malloc(3) upon the first
          getc(3) or putc on the file.  Initially, the standard stream
          stderr is unbuffered, and the standard stream stdout is
          flushed automatically whenever new data is read by getc. The
          latter magic may be dissolved by a call to setbuf.

     SEE ALSO
          stdio(3), malloc(3)