setbuffer, setlinebuf
Purpose
Assigns buffering to a stream.
Library
Berkeley Library (libbsd.a)
Syntax
void setbuffer (stream, buf, size) void setlinebuf (stream)
FILE *stream; FILE *stream;
char *buf, *size;
Description
The setbuffer subroutine, an alternate form of the setbuf
subroutine described on page 3-397, is used after stream
has been opened, but before it is read or written. The
character array buf, whose size is determined by the size
parameter, is used instead of an automatically allocated
buffer. If the buf parameter is a null character
pointer, input/output is completely unbuffered.
The setbuffer subroutine is not needed under normal cir-
cumstances since the default file I/O buffer size are
optimal.
The setlinebuf subroutine is used to change stdout or
stderr from block buffered or unbuffered to line buf-
fered. Unlike the setbuf and setbuffer subroutines, the
setlinebuf subroutine can be used any time the file
descriptor is active.
Note: Because the setbuffer and setlinebuf subroutines
are implemented in AIX using the setvbuf system call,
these routines may not function exactly as they do in
4.3BSD.
For more information on stream buffering, see "setbuf,
setvbuf."
Related Information
In this book: "fclose, fflush," "fopen, freopen,
fdopen," "fread, fwrite," "getc, fgetc, getchar, getw,"
"malloc, free, realloc, calloc," "printf, fprintf,
sprintf, NLprintf, NLfprintf, NLsprintf," "putc, putchar,
fputc, putw," "puts, fputs," and "setbuf, setvbuf."