fix to reeves fix of dgo handling (reset b_active to 1)
[unix-history] / .ref-BSD-3 / usr / man / man3 / setbuf.3s
CommitLineData
e6817382
BJ
1.TH SETBUF 3S
2.SH NAME
3setbuf \- assign buffering to a stream
4.SH SYNOPSIS
5.B #include <stdio.h>
6.PP
7.B setbuf(stream, buf)
8.br
9.SM
10.B FILE
11.B *stream;
12.br
13.B char *buf;
14.SH DESCRIPTION
15.I Setbuf
16is used after a stream has been opened but before it
17is read or written.
18It causes the character array
19.I buf
20to be used instead of an automatically allocated buffer.
21If
22.I buf
23is the constant pointer
24.SM
25.B NULL,
26input/output will be completely unbuffered.
27.PP
28A manifest constant
29.SM
30.B BUFSIZ
31tells how big an array is needed:
32.PP
33.in +10
34char buf[BUFSIZ];
35.PP
36A buffer is normally obtained from
37.IR malloc (3)
38upon the first
39.I getc
40or
41.IR putc (3)
42on the file,
43except that output streams directed to terminals,
44and the standard error stream
45.I stderr
46are normally not buffered.
47.SH "SEE ALSO"
48fopen(3), getc(3), putc(3), malloc(3)