Welcome to little lamb

Code » limb » release » tree

[release] / src / doc / buffer.h / buffer_putbase32.3.md

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

# NAME

buffer\_putbase32, buffer\_putbase64 - write byte array content encoded in
base32/base64 into buffer

# SYNOPSIS

    #include <limb/buffer.h>

```pre hl
ssize_t buffer_putbase32(buffer *<em>buf</em>, const char *<em>data</em>, size_t <em>dlen</em>, int <em>pad</em>)
ssize_t buffer_putbase64(buffer *<em>buf</em>, const char *<em>data</em>, size_t <em>dlen</em>, int <em>pad</em>)
```

# DESCRIPTION

The `buffer_putbase32`() function writes the content of byte array pointed to by
`data` of length `dlen` bytes into buffer `buf` encoded in base32. Padding will
be used in the output unless `pad` is zero.

For more about the encoding, refer to [base32_fmt](3).

The `buffer_putbase64`() function writes the content of byte array pointed to by
`data` of length `dlen` bytes into buffer `buf` encoded in base64. Padding will
be used in the output unless `pad` is zero.

For more about the encoding, refer to [base64_fmt](3).

# RETURN VALUE

These functions return the number of bytes written into `buf` on success.
Otherwise, they return -1 and set `errno` to indicate the error.

# ERRORS

These functions may fail and set `errno` for any of the errors specified for
[buffer_put](3).