mmioSetInfo
Appearance
The mmioSetInfo function updates information on a file I/O buffer of a file opened for buffered I/O. This is typically used to terminate direct buffer access.
Syntax
#define INCL_MMIOOS2 #include <os2.h> USHORT mmioSetInfo(HMMIO hmmio, PMMIOINFO pmmioinfo, USHORT usFlags);
Parameters
- pmmioinfo (PMMIOINFO) - input
- The caller-allocated MMIOINFO buffer that was previously filled with information by mmioGetInfo and potentially modified by the application.
- usFlags (USHORT) - input
- Reserved for future use and must be set to zero.
Return Value
- rc (USHORT) - returns
- Return codes indicating success or type of failure:
- MMIO_SUCCESS: If the function succeeds, 0 is returned.
- MMIOERR_UNBUFFERED: Tried to disable a buffer that was already disabled.
- MMIOERR_INVALID_HANDLE: The handle passed was not correct.
- MMIOERR_INVALID_PARAMETER: An incorrect parameter was passed.
Remarks
If you are using buffered I/O and have written directly to the buffer (direct buffer access), you must set the `MMIO_DIRTY` flag in the ulFlags field of the MMIOINFO structure before calling **mmioSetInfo**. If this flag is not set, the MMIO Manager will assume the buffer has not changed and will not write its contents to disk.
Example Code
The following code illustrates how to retrieve file information, perform operations, and then update the state back to the MMIO Manager.
HMMIO hmmio1;
MMIOINFO mmioinfo;
USHORT usFlags = 0;
USHORT rc;
...
/* Retrieve current info */
memset(&mmioinfo, '\0', sizeof(MMIOINFO));
rc = mmioGetInfo(hmmio1, &mmioinfo, usFlags);
if (rc) {
/* error */
} else {
/*
* Perform direct buffer access or low-level I/O
* If you write to the buffer, mark it dirty:
* mmioinfo.ulFlags |= MMIO_DIRTY;
*/
...
}
/* Update the MMIO Manager with new info state */
rc = mmioSetInfo(hmmio1, &mmioinfo, usFlags);
if (rc) {
/* error */
} else {
/* Success */
}
...