Skip to content

Simple C binary serialization library (with Python struct.pack-like interface).

Notifications You must be signed in to change notification settings

KrystianD/structpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

structpack

Simple C serialization library (with Python struct.pack-like interface)

Build Status

Example

Packing

uint8_t buf[100];

uint32_t a = 34678, c = 1234;
uint8_t b = 45;
int r = StructPack::pack(buf, 100, "LBL6s", a, b, c, "test", 4);

buf now contains:

\x76\x87\x00\x00\x2d\xd2\x04\x00\x00test\x00\x00

Unpacking

uint32_t a, c;
uint8_t b;
char text[100];

StructPack::unpack(buf, 100, "LBL6s", &a, &b, &c, text, 100);

About

Simple C binary serialization library (with Python struct.pack-like interface).

Topics

Resources

Stars

Watchers

Forks