Full prototype:

void setbuf(FILE* restrict, char* restrict);  

Purpose and Notes:

Sets the type of buffering you want for the stream associated with the FILE* passed in as the first argument.

Almost equivalent to the function setvbuf() invoked with _IOFBF and BUFSIZ if the second argument is non NULL and setvbuf() with the arguments _IONBF if NULL is passed in as the second argument. Unlike the setvbuf() function this function has no return value.

This function is mostly kept around for legacy reasons and backwards compatibility with old code bases. It is recommended to not use and to use setvbuf() instead.


void- Nothing

Argument 1:

FILE* restrict- A file pointer to the stream in which you want to set or modify the buffering for.

Argument 2:

char* restrict- A character array buffer in which you want to use for the buffering. If this value is passed in as NULL then no buffering will used for the stream passed in associated with the first argument's FILE*.

Example 1