fmt_copybytes_sizeof_minus1 − write binary data
#include <libowfat/fmt.h>
size_t fmt_copybytes_sizeof_minus1(char *dest,const char *source);
This macro will copy sizeof(source)-1 bytes from source to dest.
This is a convenience wrapper interface around fmt_copybytes for the situation where you construct a binary message by concatenating hex constant strings like this:
fmt_copybytes_sizeof_minus1(dest, "\x01\x02\x03\x04");
Since the source is technically a string, the compiler will add a 0 byte and sizeof() will return the size including that 0 byte. That is why we have a minus 1 in this function, so we do not copy or count that 0 byte.
Caution: source must not have side effects or those will be evaluated twice.
fmt_copybytes(3)