Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

27 lines
896 B

  1. .TH fmt_copybytes_sizeof_minus1 3
  2. .SH NAME
  3. fmt_copybytes_sizeof_minus1 \- write binary data
  4. .SH SYNTAX
  5. .B #include <libowfat/fmt.h>
  6. size_t \fBfmt_copybytes_sizeof_minus1\fP(char *\fIdest\fR,const char *\fIsource\fR);
  7. .SH DESCRIPTION
  8. This macro will copy sizeof(\fIsource\fP)-1 bytes from \fIsource\fP to \fIdest\fP.
  9. This is a convenience wrapper interface around
  10. \fIfmt_copybytes\fP for the situation where you construct a binary
  11. message by concatenating hex constant strings like this:
  12. fmt_copybytes_sizeof_minus1(dest, "\\x01\\x02\\x03\\x04");
  13. Since the source is technically a string, the compiler will add a 0 byte
  14. and sizeof() will return the size including that 0 byte. That is why we
  15. have a minus 1 in this function, so we do not copy or count that 0 byte.
  16. .SH NOTE
  17. Caution: \fIsource\fP must not have side effects or those will be
  18. evaluated twice.
  19. .SH "SEE ALSO"
  20. fmt_copybytes(3)