1buffer(3)                  Library Functions Manual                  buffer(3)
2
3
4

NAME

6       buffer.h - generic read/write buffering
7

SYNTAX

9       #include <buffer.h>
10
11         buffer* buffer_0;   /* like stdio's stdin */
12         buffer* buffer_1;   /* like stdio's stdout */
13         buffer* buffer_2;   /* like stdio's stderr */
14
15

DESCRIPTION

17       buffer.h  provides a generic buffer interface that can be used for read
18       and write buffering.  Buffers must be initialized with buffer_init.
19
20       A buffer can only be used for reading or writing at the same time,  not
21       both.
22
23       Unlike stdio, these write buffers are not flushed automatically at pro‐
24       gram  termination;  you   must   manually   call   buffer_flush,   buf‐
25       fer_putsflush, buffer_putflush or buffer_putnlflush.
26
27

EXAMPLE

29       See  buffer_init(3) for example read buffer code.  Here is typical code
30       for printing an error message on stderr:
31
32         #include <buffer.h>
33
34         buffer_puts(buffer_2,"error: got only ");
35         buffer_putulong(buffer_2,got);
36         buffer_puts(buffer_2," bytes, but expected at least ");
37         buffer_putulong(buffer_2,expected);
38         buffer_putsflush(buffer_2," bytes!");
39
40

SEE ALSO

42       buffer_init(3), buffer_put(3), buffer_get(3), buffer_flush(3)
43
44
45
46                                                                     buffer(3)
Impressum