When you finish accessing a file I/O buffer, pass the MMIOINFO structure filled by mmioGetInfo to mmioSetInfo to end direct access to the I/O buffer. Before calling mmioSetInfo, make sure that you set the MMIO_DIRTY flag of the ulFlags field of pmmioinfo if you have written to the buffer. Otherwise, the contents of the buffer will not get emptied to disk. When mmioSetInfo is called, then the caller should stop accessing the I/O buffer directly and revert to using mmioRead and mmioWrite to read from and write to the file.

The following code fragment illustrates how to directly read an I/O buffer.

mmioGetInfo(hmmio, &mmioinfo, 0)
mmioAdvance(hmmio, &mmioinfo, MMIO_READ)
for (i=0, iCount=0;  i<20; i++)
 iCount += *(mmioinfo.pchNext)++;
mmioSetInfo(hmmio, &mmioinfo, 0);


[Back] [Next]