NAME

setbuf - assign buffering to a stream

SYNOPSIS

#include <stdio.h>

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

DESCRIPTION

setbuf() may be used after a stream has been opened but before it is read or written. It causes the array pointed to by buf to be used instead of an automatically allocated buffer. If buf is the NULL pointer input/output will be completely unbuffered.

While there is no limitation on the size of the buffer, the constant BUFSIZ, defined in the <stdio.h> header, is typically a good buffer size.

RETURN VALUES

The setbuf() function does not return a value.

ERRORS

No errors are defined.

SEE ALSO

fopen(), getc(), malloc(), putc()

NOTES

A common source of error is allocating buffer space as an ``automatic'' variable in a code block, and then failing to close the stream in the same block.


< Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2011 >