NAME

catbuf_ch - get next byte from a data buffer

SYNOPSIS

#include <cat.h>

int catbuf_ch(cat_buffer *b);

DESCRIPTION

catbuf_ch() (macro) returns the next byte from the buffer and increments the offset counter.

This function, together with catbuf_index(), cabuf_len(), and catbuf_pos() are the low-level selectors and modifiers for data buffers.

RETURN VALUES

Returns the next byte in the buffer. When the end of the buffer is reached, -1 is returned and the index is not incremented.

EXAMPLE

To print the contents of buffer b to the standard output, do the following:

 int c;

 catbuf_index(b, 0);
 while ((c = catbuf_ch(b)) > -1) {
     putchar(c);
 }

SEE ALSO

cat, catbuf catbuf_index, catbuf_len, catbuf_pos