dtbytes
Hexadecimal formatting of byte sequences for inspection.
This group of functions provides byte-to-text hexadecimal formatting for diagnostic output.
Usefor inspection and logging of raw byte buffers in C programs.
Mini-guide
- Formats a contiguous byte buffer into uppercase hexadecimal text.
- Groups output into fixed 4-byte blocks by inserting a single space after every fourth byte.
- Requires the caller to provide sufficient output space because truncation occurs silently when the buffer is too small.
Example
uint8_t data[8] = { 0xF0, 0x03, 0x00, 0x00, 0x19, 0x05, 0x00, 0x00 };
char text[32];
dtbytes_compose_hex(data, 8, text, sizeof(text));
Functions
dtbytes_compose_hex
Formats a byte buffer as a grouped hexadecimal string.
Params:
const void* sourcePointer to the input byte buffer.
int32_t source_lengthNumber of bytes to read from the source buffer.
char* outputPointer to the output character buffer.
int32_t output_lengthSize of the output buffer in bytes.
Return: void No return value.