File: buffer_peek.3

package info (click to toggle)
libowfat 0.27-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,412 kB
  • ctags: 1,147
  • sloc: ansic: 12,294; makefile: 42
file content (23 lines) | stat: -rw-r--r-- 618 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
.TH buffer_peek 3
.SH NAME
buffer_peek \- return pointer to string in buffer
.SH SYNTAX
.B #include <buffer.h>

int \fBbuffer_peek\fP(buffer* \fIb\fR);
.SH DESCRIPTION
buffer_peek returns a pointer to the first byte of the string in the
buffer.
.SH EXAMPLE
buffer_feed, buffer_peek and buffer_seek can be used for efficient reading
loops, nearly the same speed as calling \fBop\fR directly:

  for (;;) {
    r = buffer_feed(&b);
    if (r <= 0) return r;
    x = buffer_peek(&b);
    dosomething(x,r);
    buffer_seek(&b,r);
  }
.SH "SEE ALSO"
buffer_init(3), buffer_feed(3), buffer_get(3), buffer_seek(3), buffer(3)