[Top] [Prev] [Next]

seek - change file offset

include "sys.m";
sys:= load Sys Sys->PATH;
seek: fn(fd: ref FD, off, start: int): int;


seek (fd, off, start)

The seek function sets the offset for the file associated with fd to off as qualified by the start argument. Negative values for off are allowed.

The start argument can have the following values:

The offset is set to off bytes from the start of the file.


The offset is set to its current value plus off bytes.


The offset is set to the size of the file plus off bytes.

The new file offset value is returned.

The seek function does not validate the offset being set. Subsequent read or write calls to an invalid offset will fail.

Seeking in a directory is not allowed.

The current offset for a file is shared among processes of the same file descriptor group. See pctl - process control.

See Also
Limbo System Module,

open, create - open/create a file for reading or writing,

pctl - process control, read, write, stream - read, write, or stream file,

bufio - buffered input/output module in Chapter 15

[Top] [Prev] [Next]

Copyright © 1996,Lucent Technologies, Inc. All rights reserved.