1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1993 The Regents of the University of California.
|
3 |
|
|
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
4 |
|
|
'\"
|
5 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
6 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
7 |
|
|
'\"
|
8 |
|
|
'\" RCS: @(#) $Id: seek.n,v 1.1.1.1 2002-01-16 10:25:25 markom Exp $
|
9 |
|
|
'\"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.TH seek n 7.5 Tcl "Tcl Built-In Commands"
|
12 |
|
|
.BS
|
13 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
14 |
|
|
.SH NAME
|
15 |
|
|
seek \- Change the access position for an open channel
|
16 |
|
|
.SH SYNOPSIS
|
17 |
|
|
\fBseek \fIchannelId offset \fR?\fIorigin\fR?
|
18 |
|
|
.BE
|
19 |
|
|
|
20 |
|
|
.SH DESCRIPTION
|
21 |
|
|
.PP
|
22 |
|
|
Changes the current access position for \fIchannelId\fR.
|
23 |
|
|
\fIChannelId\fR must be a channel identifier such as returned from a
|
24 |
|
|
previous invocation of \fBopen\fR or \fBsocket\fR.
|
25 |
|
|
The \fIoffset\fR and \fIorigin\fR
|
26 |
|
|
arguments specify the position at which the next read or write will occur
|
27 |
|
|
for \fIchannelId\fR. \fIOffset\fR must be an integer (which may be
|
28 |
|
|
negative) and \fIorigin\fR must be one of the following:
|
29 |
|
|
.TP 10
|
30 |
|
|
\fBstart\fR
|
31 |
|
|
The new access position will be \fIoffset\fR bytes from the start
|
32 |
|
|
of the underlying file or device.
|
33 |
|
|
.TP 10
|
34 |
|
|
\fBcurrent\fR
|
35 |
|
|
The new access position will be \fIoffset\fR bytes from the current
|
36 |
|
|
access position; a negative \fIoffset\fR moves the access position
|
37 |
|
|
backwards in the underlying file or device.
|
38 |
|
|
.TP 10
|
39 |
|
|
\fBend\fR
|
40 |
|
|
The new access position will be \fIoffset\fR bytes from the end of
|
41 |
|
|
the file or device. A negative \fIoffset\fR places the access position
|
42 |
|
|
before the end of file, and a positive \fIoffset\fR places the access
|
43 |
|
|
position after the end of file.
|
44 |
|
|
.LP
|
45 |
|
|
The \fIorigin\fR argument defaults to \fBstart\fR.
|
46 |
|
|
.PP
|
47 |
|
|
The command flushes all buffered output for the channel before the command
|
48 |
|
|
returns, even if the channel is in nonblocking mode.
|
49 |
|
|
It also discards any buffered and unread input.
|
50 |
|
|
This command returns an empty string.
|
51 |
|
|
An error occurs if this command is applied to channels whose underlying
|
52 |
|
|
file or device does not support seeking.
|
53 |
|
|
|
54 |
|
|
.SH KEYWORDS
|
55 |
|
|
access position, file, seek
|