Go to the first, previous, next, last section, table of contents.
#include <unistd.h> offset_t llseek(int fd, offset_t offset, int whence);
This function moves the file pointer for fd according to whence:
SEEK_SET
SEEK_CUR
SEEK_END
offset is of type long long, thus enabling you to seek with offsets as large as ~2^63 (FAT16 limits this to ~2^31; FAT32 limits this to 2^32-2).
The new offset is returned. Note that due to limitations in the underlying DOS implementation the offset wraps around to 0 at offset 2^32. -1 means the call failed.
not ANSI, not POSIX
long long ret; ret = llseek(fd, (1<<32), SEEK_SET); /* Now ret equals 0 * (unfortunately). */ ret = llseek(fd, -1, SEEK_CUR); /* Now ret equals 2^32-1 (good!). */ ret = llseek(fd, 0, SEEK_SET); /* Now ret equals 0 (good!). */ ret = llseek(fd, -1, SEEK_CUR); /* Now ret equals 2^32-1 (bad). */
Go to the first, previous, next, last section, table of contents.