1tell(n)                      Tcl Built-In Commands                     tell(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       tell - Return current access position for an open channel
9

SYNOPSIS

11       tell channelId
12_________________________________________________________________
13
14

DESCRIPTION

16       Returns  an  integer string giving the current access position in chan‐
17       nelId.  This value returned is a byte offset that can be passed to seek
18       in  order  to set the channel to a particular position.  Note that this
19       value is in terms of  bytes,  not  characters  like  read.   The  value
20       returned is -1 for channels that do not support seeking.
21
22       ChannelId must be an identifier for an open channel such as a Tcl stan‐
23       dard channel (stdin, stdout, or stderr), the return value from an invo‐
24       cation  of  open or socket, or the result of a channel creation command
25       provided by a Tcl extension.
26

EXAMPLE

28       Read a line from a file channel only if it starts with foobar:
29              # Save the offset in case we need to undo the read...
30              set offset [tell $chan]
31              if {[read $chan 6] eq "foobar"} {
32                  gets $chan line
33              } else {
34                  set line {}
35                  # Undo the read...
36                  seek $chan $offset
37              }
38
39

SEE ALSO

41       file(n), open(n), close(n), gets(n), seek(n), Tcl_StandardChannels(3)
42
43

KEYWORDS

45       access position, channel, seeking
46
47
48
49Tcl                                   8.1                              tell(n)
Impressum