|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
#include <unistd.h> offset_t llseek(int fd, offset_t offset, int whence);
This function moves the file pointer for fd according to whence:
The file pointer is moved to the offset specified.
The file pointer is moved relative to its current position.
The file pointer is moved to a position offset bytes from the end of the file. The offset is usually nonpositive in this case.
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.
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). */
|webmaster donations bookstore||delorie software privacy|
|Copyright © 2004 by DJ Delorie||Updated Apr 2004|