pips_guid_format()

Updated: April 19, 2023

Write a GUID as a hexadecimal string to a character buffer

Synopsis:

#include <pips/pips.h>
int pips_guid_format(const pips_guid_t *const guid,
                     char *buffer,
                     const size_t buffer_size)

Arguments:

guid
A pointer to the GUID to format
buffer
A character buffer for storing the formatted GUID
buffer_size
The size, in bytes, of the output buffer

Library:

pips-client

Description:

This function encodes (formats) the current GUID as a hexadecimal string and writes the result in the given buffer. The formatted GUID occupies 32 bytes and the NULL-terminator occupies one extra byte; the buffer must be large enough to accommodate this.

Returns:

On success, the number of characters written to the buffer, excluding the NULL-terminator. On error, a negative value (errno is set).

Errors:

  • EINVAL: The GUID or output buffer is invalid.
  • ENOBUFS: The buffer isn't large enough to accommodate the encoded GUID string.