Implement examples/unpack.c

This commit is contained in:
XANTRONIX Development 2020-09-22 09:37:11 -05:00
parent 448937b6fb
commit 272d9fe38c
2 changed files with 3 additions and 3 deletions

View file

@ -7,7 +7,7 @@ INCLUDE_PATH = ../include
CFLAGS += -I$(INCLUDE_PATH)
LDFLAGS = -L../src -lskipstone
EXAMPLES = read map test queue pack
EXAMPLES = read map test queue pack unpack
RM = /bin/rm

View file

@ -6,14 +6,14 @@
#include <skipstone/message.h>
int main(int argc, char **argv) {
uint8_t buf[6] = "\x5KMFDM",
uint8_t buf[7] = "\x5KMFDM",
str[SKIPSTONE_MESSAGE_MAX_STRLEN];
if (skipstone_message_unpack(buf, sizeof(buf), "z", str) < 0) {
fprintf(stderr, "%s: %s: %s\n",
argv[0], "skipstone_message_unpack()", strerror(errno));
goto message_unpack;
goto error_message_unpack;
}
printf("%s\n", str);