The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

setbuf - assign buffering to a stream

 SYNOPSIS



#include <stdio.h>

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

 DESCRIPTION

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.

 RETURN VALUE

The setbuf() function returns no value.

 ERRORS

No errors are defined.

 EXAMPLES

None.

 APPLICATION USAGE

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 setbuf(), allocating a buffer of BUFSIZ bytes does not necessarily imply that all of BUFSIZ bytes are used for the buffer area.

 FUTURE DIRECTIONS

None.

 SEE ALSO

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

DERIVATION

Derived from Issue 1 of the SVID.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]