28 lines
608 B
C
28 lines
608 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <inttypes.h>
|
|
#include <errno.h>
|
|
|
|
#include <skipstone/message.h>
|
|
|
|
int main(int argc, char **argv) {
|
|
uint8_t buf[11] = "\x5KMFDM\x04\x03\x02\x01",
|
|
str[SKIPSTONE_MESSAGE_MAX_STRLEN];
|
|
|
|
uint32_t num;
|
|
|
|
if (skipstone_message_unpack(buf, sizeof(buf), "zL", str, &num) < 0) {
|
|
fprintf(stderr, "%s: %s: %s\n",
|
|
argv[0], "skipstone_message_unpack()", strerror(errno));
|
|
|
|
goto error_message_unpack;
|
|
}
|
|
|
|
printf("%s: %" PRIu32 "\n", str, num);
|
|
|
|
return 0;
|
|
|
|
error_message_unpack:
|
|
return 1;
|
|
}
|