Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / buffer.h / buffer_puthex.3.md

% limb manual
% buffer_puthex(3)
% limb 0.1.0
% 2023-07-24

# NAME

buffer\_puthex - write byte array content as hexadecimal dump into buffer

# SYNOPSIS

    #include <limb/buffer.h>

```pre hl
ssize_t buffer_puthex(buffer *<em>buf</em>, const void *<em>data</em>, size_t <em>dlen</em>, int <em>options</em>)
```

# DESCRIPTION

The `buffer_puthex`() function will write the content of byte array pointed to
by `data` of length `dlen` into the buffer `buf` as an hexadecimal dump, i.e.
every byte's value will be written out in 2-character hexadecimal form.

Additionally, it is possible to specify some flags in `options` to affect the
output, adding spaces and/or newlines. Refer to [hexall_fmt](3) for more.

# RETURN VALUE

The `buffer_puthex`() function returns the number of bytes written into `buf`
on success. Otherwise, it returns -1 and sets `errno` to indicate the error.

# ERRORS

The `buffer_puthex`() function may fail and set `errno` for any of the errors
specified for [buffer_put](3).