C4 Engine
C4 Engine API Documentation


Defined in:  C4Packing.h
Writes a chunk type and begins measuring the size of a chunk in the output stream.

PackHandle BeginChunk(uint32 type);

type The chunk type.
The BeginChunk function writes the four-byte chunk type specified by the type parameter to the output stream and then reserves four bytes in the output stream to which the size of the chunk is later written. This function returns a handle that should be passed to the Packer::EndChunk function. When the EndChunk function is called, the number of bytes written to the output stream since the matching call to BeginChunk is written into the four-byte location immediately following the chunk type.
IMPORTANT. In order to maintain four-byte alignment in the output stream, the number of bytes written between calls to the BeginChunk and EndChunk function must be a multiple of four.
See Also