.TH setbuf() "" "" "STDIO Function (libc)"
.PC "Set alternative stream buffer"
.B "#include <stdio.h>"
\fBvoid setbuf(\fIfp\fR, \fIbuffer\^\fB)\fR
\fBFILE *\fIfp\^\fB; char *\fIbuffer\^\fB;\fR
.PP
The standard I/O library STDIO
automatically buffers all data read and written
in streams, with the exception of streams to terminal devices.
.II BUFSIZ
STDIO normally uses
.B malloc()
to allocate the buffer, which is a
.B char
array
.B BUFSIZ
characters long;
.B BUFSIZ
is a manifest constant defined in the header file
.BR stdio.h .
.PP
.BR setbuf() 's
arguments are the file stream
.I fp
and the
.I buffer
to be associated with the stream.
The call should be issued
after the stream has been opened, but
before any input or output request has been issued.
If \fIbuffer\fR is NULL, the stream will be unbuffered.
If \fIbuffer\fR is not NULL, the arena of memory it points to must
contain at least
.B BUFSIZ
bytes.
.PP
.B setbuf()
returns nothing.
.SH "See Also"
.Xr "fopen()," fopen
.Xr "libc," libc
.Xr "malloc()," malloc
.Xr "setvbuf()" setvbuf
.br
\*(AS, \(sc7.9.5.5
.br
\*(PX Standard, \(sc8.1
