You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.1 KiB
Groff
27 lines
1.1 KiB
Groff
.TH buffer_get 3
|
|
.SH NAME
|
|
buffer_get \- read binary data from buffer
|
|
.SH SYNTAX
|
|
.B #include <buffer.h>
|
|
|
|
ssize_t \fBbuffer_get\fP(buffer* \fIb\fR,char* \fIx\fR,size_t \fIlen\fR);
|
|
.SH DESCRIPTION
|
|
Normally buffer_get copies data to \fIx\fR[0], \fIx\fR[1], ...,
|
|
\fIx\fR[\fIlen\fR-1] from the beginning of a string stored in
|
|
preallocated space; removes these \fIlen\fR bytes from the string; and
|
|
returns \fIlen\fR.
|
|
|
|
If, however, the string has fewer than \fIlen\fR (but more than 0)
|
|
bytes, buffer_get copies only that many bytes, and returns that number.
|
|
|
|
If the string is empty, buffer_get first uses a \fBread operation\fR to
|
|
feed data into the string. The \fBread operation\fR may indicate end of
|
|
input, in which case buffer_get returns 0; or a read error, in which
|
|
case buffer_get returns -1, setting \fIerrno\fR approporiately.
|
|
|
|
The preallocated space and the \fBread operation\fR are specified by
|
|
\fIb\fR. You must initialize \fBb\fR using buffer_init before calling
|
|
buffer_get (or use the pre-initialized buffer_0).
|
|
.SH "SEE ALSO"
|
|
buffer_init(3), buffer_feed(3), buffer_peek(3), buffer_seek(3), buffer(3)
|