1SETBUF(3S) SETBUF(3S)
2
3
4
6 setbuf - assign buffering to a stream
7
9 #include <stdio.h>
10
11 setbuf(stream, buf)
12 FILE *stream;
13 char *buf;
14
16 Setbuf is used after a stream has been opened but before it is read or
17 written. It causes the character array buf to be used instead of an
18 automatically allocated buffer. If buf is the constant pointer NULL,
19 input/output will be completely unbuffered.
20
21 A manifest constant BUFSIZ tells how big an array is needed:
22
23 char buf[BUFSIZ];
24
25 A buffer is normally obtained from malloc(3) upon the first getc or
26 putc(3) on the file, except that output streams directed to terminals,
27 and the standard error stream stderr are normally not buffered.
28
30 fopen(3), getc(3), putc(3), malloc(3)
31
32
33
34 SETBUF(3S)