1buffer_getn(3) Library Functions Manual buffer_getn(3)
2
3
4
6 buffer_getn - read binary data from buffer
7
9 #include <buffer.h>
10
11 ssize_t buffer_getn(buffer* b,char* x,size_t len);
12
14 buffer_getn copies data to x[0], x[1], ..., x[len-1] from the buffer,
15 calling buffer_feed as needed, and returns len.
16
17 If a read error occurs, buffer_getn returns -1 and sets errno appropri‐
18 ately. It may then have put any number between 0 and len in the buf‐
19 fer, you can't tell. That makes this function only useful if you don't
20 care when an error occurs. Use buffer_get otherwise.
21
22 If the read operation signals end-of-file before len bytes were read,
23 buffer_getn returns the number of bytes read from the buffer before
24 end-of-file.
25
27 buffer_init(3), buffer_get(3), buffer(3)
28
29
30
31 buffer_getn(3)