setbuf (stream, buf)
FILE *stream;
char *buf;
A manifest constant BUFSIZ tells how big an array is needed: char buf[BUFSIZ]; A buffer is normally obtained from malloc(3P) upon the first getc or putc(3P) on the file, except that output streams directed to terminals, and the standard error stream stderr are normally not bufferd.
A common source of error is allocation of buffer space as an automatic variable in a code block, and then failing to close the stream in the same block.