plan9port/man/man3/seek.3

54 lines
804 B
Groff
Raw Normal View History

2004-04-10 18:53:55 +00:00
.TH SEEK 3
.SH NAME
seek \- change file offset
.SH SYNOPSIS
.B #include <u.h>
.br
.B #include <libc.h>
.PP
.B
vlong seek(int fd, vlong n, int type)
.SH DESCRIPTION
.I Seek
sets the offset for the file
associated with
.I fd
as follows:
.IP
If
.I type
is 0, the offset is set to
.I n
bytes.
.IP
If
.I type
is 1, the pointer is set to its current location plus
.IR n .
.IP
If
.I type
is 2, the pointer is set to the size of the
file plus
.IR n .
.PP
The new file offset value is returned.
.PP
Seeking in a directory is not allowed.
Seeking in a pipe is a no-op.
.SH SOURCE
2005-01-11 17:37:33 +00:00
.B \*9/src/lib9/seek.c
2004-04-10 18:53:55 +00:00
.SH SEE ALSO
.IR intro (3),
.IR open (3)
2004-04-10 18:53:55 +00:00
.SH DIAGNOSTICS
Sets
.IR errstr .
2005-01-13 04:49:19 +00:00
.SH BUGS
To avoid name conflicts with the underlying system,
.I seek
is a preprocessor macro defined as
.IR p9seek ;
see
.IR intro (3).