buffer_put(3) write binary data to buffer

SYNTAX

#include <buffer.h>

int buffer_put(buffer* b,const char* x,size_t len);

DESCRIPTION

buffer_put writes len bytes from x to b.

The difference to buffer_putalign is that, when there isn't enough space for new data, buffer_put calls buffer_flush before copying any data, while buffer_putalign fills all available space with data before calling buffer_flush.

RETURN VALUE

buffer_put returns 0 if everything was fine, -1 on error (setting errno).