Name | Description | Notes | Source | Availability | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
_IOFBF |
Full-buffering flag | M | <stdio.h> |
C89 | C90 | C95 | C99 | C11 | |||
_IOLBF |
Line-buffering flag | M | <stdio.h> |
C89 | C90 | C95 | C99 | C11 | |||
_IONBF |
No-buffering flag | M | <stdio.h> |
C89 | C90 | C95 | C99 | C11 | |||
BUFSIZ |
Built-in buffer size for I/O | M | <stdio.h> |
C89 | C90 | C95 | C99 | C11 | |||
setbuf() |
Set stream buffer | (·) | <stdio.h> |
C89 | C90 | C95 | C99 | C11 | |||
setvbuf() |
Set stream buffer | (·) | <stdio.h> |
C89 | C90 | C95 | C99 | C11 |
#include <stdio.h>
void setbuf(FILE *str,
char *buf);
int setvbuf(FILE *str,
char *buf,
int mode,
size_t sz);
setvbuf
and
setbuf
set
the buffering on a stream str
that has just
been opened. mode
can have the
following values:
Value of mode |
Buffering mode |
---|---|
_IOFBF |
full buffering |
_IOLBF |
line buffering |
_IONBF |
no buffering |
buf
may point to a buffer of
sz
bytes to be used, or it may be
NULL
, indicating that the
function should allocate a buffer internally. setvbuf
returns non-zero if mode
is invalid,
or it cannot otherwise change the stream's buffering.
BUFSIZ
is the buffer size that setbuf
assumes (lacking a parameter sz
).
setbuf(str,
buf)
is equivalent to setvbuf(str,
NULL, _IONBF,
BUFSIZ)
if buf
is NULL
, or to setvbuf(str, buf,
_IOFBF,
BUFSIZ)
otherwise. It also discards the return value. BUFSIZ
is at least 256
.