mmioCreateChunk

Syntax

WORD mmioCreateChunk(hmmio, lpck, wFlags)

This function creates a chunk in a RIFF file opened with mmioOpen. The new chunk is created at the current file position. After the new chunk is created, the current file position is the beginning of the data portion of the new chunk.

Parameters

HMMIO hmmio

Specifies the file handle of an open RIFF file.

LPMMCKINFO lpck

Specifies a pointer to a caller-supplied MMCKINFO structure containing information about the chunk to be created. Set up the MMCKINFO structure as follows:

The ckid field specifies the chunk ID of the chunk. If wFlags includes MMIO_CREATERIFF or MMIO_CREATELIST, this field will be filled by mmioCreateChunk.

The cksize field specifies the size of the data portion of the chunk, including the form type or list type (if any). If this value is not correct when mmioAscend is called to mark the end of the chunk, them mmioAscend will correct the chunk size.

The fccType field specifies the form type or list type if the chunk is a “RIFF” or “LIST” chunk. If the chunk is not a “RIFF” or “LIST” chunk, this field need not be filled in.

The dwDataOffset field need not be filled in. The mmioCreateChunk function will fill this field with the file offset of the data portion of the chunk.

The dwFlags field need not be filled in. The mmioCreateChunk function will set the MMIO_DIRTY flag in dwFlags.

WORD wFlags

Specifies flags to optionally create either a “RIFF” chunk or a “LIST” chunk. Can contain one of the following flags:

MMIO_CREATERIFF

Creates a “RIFF” chunk.

MMIO_CREATELIST

Creates a “LIST” chunk.

Return Value

The return value is zero if the function is successful. Otherwise, the return value specifies an error code. The error code can be one of the following codes:

MMIOERR_CANNOTWRITE

Unable to write the chunk header.

MMIOERR_CANNOTSEEK

Uanble to determine offset of data portion of the chunk.

Comments

This function cannot insert a chunk into the middle of a file. If a chunk is created anywhere but the end of a file, mmioCreateChunk will overwrite existing information in the file.