SETBUF(3) Library Functions Manual SETBUF(3)

setbufassign buffering to a stream

#include <stdio.h>

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

Except that it returns no value, the function call:

setbuf(stream, buf)
is equivalent to:
setvbuf(stream, buf, _IOFBF, BUFSIZ)

if buf is not a null pointer, or to: setvbuf(stream, buf, _IONBF, BUFSIZ)

if buf is a null pointer.

The setbuf() function returns no value.

No errors are defined.

None.

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.

With , allocating a buffer of BUFSIZ bytes does not necessarily imply that all of BUFSIZ bytes are used for the buffer area.

None.

fopen(3) , setvbuf(3) , <stdio.h> .

Derived from Issue 1 of the SVID.

February 1997 posix.fail