NAME

catbuf_copy - static read operations on a buffer

SYNOPSIS

#include <cat.h>

int catbuf_copy(cat_buffer *b, int pos, int length, void *outbuf)

DESCRIPTION

The catbuf_copy() performs a read operation on a buffer, within the buffer's size boundaries and without changing the index.

catbuf_copy() copies length, a number of bytes, from position pos in a buffer without changing the current index. The result is store in outbuf,which must be a sufficiently large area of memory allocated by the caller.

If length is negative, the entire buffer, from pos to the end of the buffer, will be copied.

A corresponding static write operation is performed by catbuf_overwrite().

RETURN VALUES

Returns the number of bytes copied or a negative code on error.

SEE ALSO

cat, catbuf, catbuf_overwrite