Searching for a Subchunk

The following example uses the mmioDescend function to search for the "FMT" chunk in the "RIFF" chunk of the previous example.

// Find the format chunk (form type "FMT"); it should be

// a subchunk of the "RIFF" parent chunk.

mmckinfoSubchunk.ckid = mmioFOURCC('f', 'm', 't', ' ');

if (mmioDescend(hmmio, &mmckinfoSubchunk, &mmckinfoParent,


// Error, cannot find the "FMT" chunk.


// "FMT" chunk found.

To search for a subchunk (that is, any chunk other than a "RIFF" or "LIST" chunk), identify its parent chunk in the lpckParent parameter of the mmioDescend function.

If you do not specify a parent chunk, the current file position should be at the beginning of a chunk before you call the mmioDescend function. If you do specify a parent chunk, the current file position can be anywhere in that chunk.

If the search for a subchunk fails, the current file position is undefined. You can use the mmioSeek function and the dwDataOffset member of the MMCKINFO structure describing the parent chunk to seek back to the beginning of the parent chunk, as in the following example:

mmioSeek(hmmio, mmckinfoParent.dwDataOffset + 4, SEEK_SET);

Because dwDataOffset specifies the offset to the beginning of the data portion of the chunk, you must seek 4 bytes past dwDataOffset to set the file position after the form type.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database