buffer_peek man page

buffer_peek — return pointer to string in buffer

Syntax

#include <buffer.h>

char* buffer_peek(buffer* b);

Description

buffer_peek returns a pointer to the first byte of the string in the buffer.

Example

buffer_feed, buffer_peek and buffer_seek can be used for efficient reading loops, nearly the same speed as calling op directly:

for (;;) {
r = buffer_feed(&b);
if (r <= 0) return r;
x = buffer_peek(&b);
dosomething(x,r);
buffer_seek(&b,r);
}

See Also

buffer_init(3), buffer_feed(3), buffer_get(3), buffer_seek(3), buffer(3)

Referenced By

buffer_feed(3), buffer_get(3), buffer_getline(3), buffer_get_token(3), buffer_get_token_pred(3), buffer_seek(3).