MMRESULT mmioAdvance(hmmio, lpmmioinfo, uFlags) | |||
HMMIO hmmio; | |||
LPMMIOINFO lpmmioinfo; | |||
UINT uFlags; |
The mmioAdvance function advances the I/O buffer of a file set up for direct I/O buffer access with mmioGetInfo. If the file is opened for reading, the I/O buffer is filled from the disk. If the file is opened for writing and the MMIO_DIRTY flag is set in the dwFlags field of the MMIOINFO structure, the buffer is written to disk. The pchNext, pchEndRead, and pchEndWrite fields of the MMIOINFO structure are updated to reflect the new state of the I/O buffer.
hmmio
Specifies the file handle for a file opened with mmioOpen.
lpmmioinfo
Optionally specifies a pointer to the MMIOINFO structure obtained with mmioGetInfo, which is used to set the current file information, then updated after the buffer is advanced.
uFlags
Specifies options for the operation. Contains exactly one of the following two flags:
Value | Meaning |
MMIO_READ | ||
The buffer is filled from the file. | ||
MMIO_WRITE | ||
The buffer is written to the file. |
The return value is zero if the operation is successful. Otherwise, the return value specifies an error code. The error code can be one of the following codes:
Value | Meaning |
MMIOERR_CANNOTWRITE | The contents of the buffer could not be written to disk. |
MMIOERR_CANNOTREAD | An error occurred while re-filling the buffer. |
MMIOERR_UNBUFFERED | The specified file is not opened for buffered I/O. |
MMIOERR_CANNOTEXPAND | The specified memory file cannot be expanded, probably because the adwInfo[0] field was set to zero in the initial call to mmioOpen. |
MMIOERR_OUTOFMEMORY | There was not enough memory to expand a memory file for further writing. |
If the specified file is opened for writing or for both reading and writing, the I/O buffer will be flushed to disk before the next buffer is read. If the I/O buffer cannot be written to disk because the disk is full, then mmioAdvance will return MMIOERR_CANNOTWRITE.
If the specified file is only open for writing, the MMIO_WRITE flag must be specified.
If you have written to the I/O buffer, you must set the MMIO_DIRTY flag in the dwFlags field of the MMIOINFO structure before calling mmioAdvance. Otherwise, the buffer will not be written to disk.
If the end of file is reached, mmioAdvance will still return success, even though no more data can be read. Thus, to check for the end of the file, it is necessary to see if the pchNext and pchEndRead fields of the MMIOINFO structure are equal after calling mmioAdvance.
mmioGetInfo