34 lines
786 B
C
34 lines
786 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
#include <unistd.h>
|
||
|
#include <errno.h>
|
||
|
|
||
|
#include <skipstone/message.h>
|
||
|
|
||
|
int main(int argc, char **argv) {
|
||
|
uint8_t buf[SKIPSTONE_MESSAGE_MAX_PAYLOAD];
|
||
|
|
||
|
ssize_t len;
|
||
|
|
||
|
if ((len = skipstone_message_pack(buf,
|
||
|
SKIPSTONE_MESSAGE_MAX_PAYLOAD,
|
||
|
"CCCC",
|
||
|
1,
|
||
|
2,
|
||
|
3,
|
||
|
4)) < 0) {
|
||
|
fprintf(stderr, "%s: %s: %s\n", argv[0],
|
||
|
"skipstone_message_pack()", strerror(errno));
|
||
|
|
||
|
goto error_message_pack;
|
||
|
}
|
||
|
|
||
|
write(1, buf, len);
|
||
|
|
||
|
return 0;
|
||
|
|
||
|
error_message_pack:
|
||
|
return 1;
|
||
|
}
|