Back to libut API Reference


SYNOPSIS


    #include "libut/ut.h"
    UT_iob *UT_iob_create(void);


DESCRIPTION

This function creates an iob data structure and returns a pointer to it. The name iob derives from input-output buffer since that was its original purpose. The iob is a dynamic-length binary buffer. In other words, it can be appended to indefinitely.

Data can be appended to the iob using UT_iob_printf(3) for formatted text or UT_iob_append(3) to copy a binary buffer into the iob. These functions can be called repeatedly and mixed together; they always append to the iob.

The content of the iob can be extracted using UT_iob_writefd(3) to write the contents to a file descriptor directly or UT_iob_flatten(3) to create a memory buffer of the iob content. An iob's length in bytes can be obtained using UT_iob_len(3). When finished with an iob, UT_iob_free(3) must be called to release its internal memory buffers.


NOTES

Internally an iob is a linked-list of malloc'd buffers. Each UT_iob_printf(3) or UT_iob_append(3) appends a link to the list.


SEE ALSO

UT_iob_printf(3), UT_iob_append(3), UT_iob_free(3), UT_iob_writefd(3), UT_iob_bufcmp(3), UT_iob_flatten(3), UT_iob_len(3)


AUTHOR

Troy D. Hanson <thanson@users.sourceforge.net>