1buffer_get(3) Library Functions Manual buffer_get(3)
2
3
4
6 buffer_get - read binary data from buffer
7
9 #include <buffer.h>
10
11 ssize_t buffer_get(buffer* b,char* x,size_t len);
12
14 Normally buffer_get copies data to x[0], x[1], ..., x[len-1] from the
15 beginning of a string stored in preallocated space; removes these len
16 bytes from the string; and returns len.
17
18 If, however, the string has fewer than len (but more than 0) bytes,
19 buffer_get copies only that many bytes, and returns that number.
20
21 If the string is empty, buffer_get first uses a read operation to feed
22 data into the string. The read operation may indicate end of input, in
23 which case buffer_get returns 0; or a read error, in which case buf‐
24 fer_get returns -1, setting errno approporiately.
25
26 The preallocated space and the read operation are specified by b. You
27 must initialize b using buffer_init before calling buffer_get (or use
28 the pre-initialized buffer_0).
29
31 buffer_init(3), buffer_feed(3), buffer_peek(3), buffer_seek(3), buf‐
32 fer(3)
33
34
35
36 buffer_get(3)