C4 Engine
C4 Engine API Documentation


Defined in:  C4Packing.h
Begins measuring the size of a section of the output stream.

PackHandle BeginSection(void);

The BeginSection function reserves four bytes in the output stream to which a size is later written, and it returns a handle that should be passed to the Packer::EndSection function. When the EndSection function is called, the number of bytes written to the output stream since the matching call to BeginSection is written into the four-byte location that was initially reserved. When unpacking, this four-byte value must be read before any of the data packed between the calls to BeginSection and EndSection is read.
IMPORTANT. In order to maintain four-byte alignment in the output stream, the number of bytes written between calls to the BeginSection and EndSection function must be a multiple of four.
See Also