C Programming Tutorial
In the C Programming Language, the setvbuf function lets you change the way a stream is buffered and to control the size and location of the buffer.
Syntax
The syntax for the setvbuf function in the C Language is:
int setvbuf(FILE *stream, char *buf, int mode, size_t size);
Parameters or Arguments
stream
The stream to modify.
buf
A pointer to the desired buffer.
mode
It is one of the following:
Mode | Explanation |
---|---|
_IOFBF | Full buffering |
_IOLBF | Line buffering |
_IONBF | No buffering |
size
The number of bytes in the buffer.
Returns
The setvbuf function returns zero if successful or a nonzero value if an error was encountered.
Required Header
In the C Language, the required header for the setvbuf function is:
#include <stdio.h>
Applies To
In the C Language, the setvbuf function can be used in the following versions:
- ANSI/ISO 9899-1990