Skip to content

Stapelzeiger/cmp_mem_access

Repository files navigation

cmp_mem_access

This library contains memory buffer access functions for the MessagePack library cmp.

Usage (see example.c for a complete version):

cmp_mem_access_t mem;
cmp_ctx_t cmp;
char buffer[128];

// initialize memory access
cmp_mem_access_init(&cmp, &mem, buffer, sizeof(buffer));

// now you can use cmp to write to the buffer
cmp_write_int(&cmp, 42);

// reset to start of buffer
cmp_mem_access_set_pos(&mem, 0);

// read back from buffer
int32_t val;
cmp_read_int(&cmp, &val);

The cmp_mem_access functions check buffer bounds and allow you to obtain the number of bytes written to the buffer using cmp_mem_access_get_pos(cmp_mem_access_t *)

installation

Just include the two files

  • cmp_mem_access.c
  • cmp_mem_access.h

in your build

About

Memory access functions for cmp (C MessagePack Library)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published