The setbuf() function specifies the buffer that stream will use or, if called with buf set to null, turns off buffering. If a programmer-defined or user-defined buffer is to be specified, it must be BUFSIZ characters long. BUFSIZ is defined in <stdio.h>.
#include<stdio.h> void setbuf(FILE *stream, char *buf);
Following c code associates a programmer-defined buffer with the stream pointed to by fp :
char buffer[BUFSIZ]; . . . setbuf(fp, buffer);