zkLseek - move the read/write file offset
#include "
zkUnistd.h"off_t zkLseek(int fildes, off_t offset, int whence);
The zkLseek() function will set the file offset for the open file description associated with the file descriptor fildes, as follows:
- If whence is SEEK_SET the file offset is set to offset bytes.
- If whence is SEEK_CUR the file offset is set to its current location plus offset.
- If whence is SEEK_END the file offset is set to the size of the file plus offset.
The symbolic constants SEEK_SET, SEEK_CUR and SEEK_END are defined in the header "zkStdio.h".
The behaviour of zkLseek() on devices which are incapable of seeking is implementation-dependent. The value of the file offset associated with such a device is undefined.
The zkLseek() function may or may not allow file offset to be set beyond the end of the existing data in the file, depending on the implementation.
Upon successful completion, the resulting offset, as measured in bytes from the beginning of the file, is returned. Otherwise, (off_t)-1 is returned, errno is set to indicate the error and the file offset will remain unchanged.
The zkLseek() function will fail if:
- [EBADF]
- The fildes argument is not an open file descriptor.
- [EINVAL]
- The whence argument is not a proper value, or the resulting file offset would be invalid.
- [EOVERFLOW]
- The resulting file offset would be a value which cannot be represented correctly in an object of type off_t.
- [ESPIPE]
- The fildes argument is associated with a pipe or FIFO.