C setbuf()

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>.

setbuf() Syntax

void setbuf(FILE *stream, char *buf);

setbuf() Example

Following c code associates a programmer-defined buffer with the stream pointed to by fp :

char buffer[BUFSIZ];
setbuf(fp, buffer);

C Online Test

« Previous Function Next Function »