Defined in header
void setbuf( FILE *stream, char *buffer );
void setbuf( FILE *restrict stream, char *restrict buffer );
Sets the internal buffer to use for stream operations. It should be at least
BUFSIZ characters long.
|stream||-||the file stream to set the buffer to|
|buffer||-||pointer to a buffer for the stream to use. If NULL is supplied, the buffering is turned off|
setvbuf should also be used to detect errors, since
setbuf does not indicate success or failure.
This function may only be used after
stream has been associated with an open file, but before any other operation (other than a failed call to setbuf/
A common error is setting the buffer of stdin or stdout to an array whose lifetime ends before the program terminates:
setbuf may be used to disable buffering on streams that require immediate output.
- C11 standard (ISO/IEC 9899:2011):
- 126.96.36.199 The setbuf function (p: 307-308)
- C99 standard (ISO/IEC 9899:1999):
- 188.8.131.52 The setbuf function (p: 273)
- C89/C90 standard (ISO/IEC 9899:1990):
- 184.108.40.206 The setbuf function
| sets the buffer and its size for a file stream |