C
You're viewing a free preview. Sign in free to read every script.
Why this exists Text logs are easy, but many things you meet are binary: network packets, database files, core dumps, package formats. Writing a C struct straight to disk looks convenient and is a trap, because the…
Binary Data: Fixed-Width Records, Endianness, Struct Padding and mmap
Write and read a binary file format safely: fixed-width types, explicit byte order instead of dumping structs, a header with magic and version, validating sizes before allocating, and memory-mapping a large file to scan it without reading it into memory.
Sign in free to read this script, along with the rest of the library.
Sign in free