Skip to content

Commit 5da1abb

Browse files
committed
Added byte stream dump.
1 parent efc27e8 commit 5da1abb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

example/c/simple_c.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#include <msgpack.h>
22
#include <stdio.h>
33

4+
void print(char const* buf, unsigned int len)
5+
{
6+
size_t i = 0;
7+
for(; i < len ; ++i)
8+
printf("%02x ", 0xff & buf[i]);
9+
printf("\n");
10+
}
11+
412
int main(void)
513
{
614
msgpack_sbuffer sbuf;
@@ -20,6 +28,8 @@ int main(void)
2028
msgpack_pack_str(&pk, 7);
2129
msgpack_pack_str_body(&pk, "example", 7);
2230

31+
print(sbuf.data, sbuf.size);
32+
2333
/* deserialize the buffer into msgpack_object instance. */
2434
/* deserialized object is valid during the msgpack_zone instance alive. */
2535
msgpack_zone_init(&mempool, 2048);
@@ -35,4 +45,3 @@ int main(void)
3545

3646
return 0;
3747
}
38-

0 commit comments

Comments
 (0)