Use the mmioSeek function to change the current position of the file pointer in an open file. This is the place where the next read or write operation is going to take place. The lOffset parameter specifies an offset to move the file position to. The lOrigin parameter specifies how the offset is interpreted.
The following example illustrates how to seek to the beginning of an open file.
mmioSeek(hFile, 0L, SEEK_SET);
To seek to the current file position:
mmioSeek(hFile, 0L, SEEK_CUR);
To seek to the end of a file:
mmioSeek(hFile, 0L, SEEK_END);
To seek to a position 20 bytes from the end of an open file:
mmioSeek(hFile, -20L, SEEK_END);
The return value is the new file position (specified in bytes) from the beginning of the file. If an error occurs, the return code is MMIO_ERROR. Use caution when seeking past the end of the file. Instead of returning MMIO_ERROR, mmioSeek returns the offset of the new file position.
Note: The mmioSeek function supports seeking in translation mode within the limits and capabilities of the specific file format IOProc that handles that format.