setvbuf function(Set Buffer) in C Language – example and detail

In the C Programming Language, the setvbuf feature lets you alternate the way a circulation is buffered and to control the measurement and region of the buffer.


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 circulation to modify. buf A pointer to the preferred 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.


The setvbuf feature returns zero if successful or a nonzero price if an error was once encountered.

Required Header

In the C Language, the required header for the setvbuf feature is:

#include <stdio.h>

Applies To

In the C Language, the setvbuf characteristic can be used in the following versions:

ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the setvbuf function:

setbuf function <stdio.h>

See Also

Other C functions that are noteworthy when dealing with the setvbuf function:

fopen feature freopen feature fflush feature