summaryrefslogtreecommitdiffstats
path: root/doc/tell.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-10-27 14:43:09 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-10-27 14:43:09 (GMT)
commit4955bdc67b8a5c3d9d12cf70cfe0b73c8a4f4ca8 (patch)
tree7a733c8f49dc66ae55cca35e7652f5bb0b1c51c6 /doc/tell.n
parent45beb64f7dcb09a6ce83532702bca760f72e6f4d (diff)
downloadtcl-4955bdc67b8a5c3d9d12cf70cfe0b73c8a4f4ca8.zip
tcl-4955bdc67b8a5c3d9d12cf70cfe0b73c8a4f4ca8.tar.gz
tcl-4955bdc67b8a5c3d9d12cf70cfe0b73c8a4f4ca8.tar.bz2
Finished user-level documentation backport
Diffstat (limited to 'doc/tell.n')
-rw-r--r--doc/tell.n15
1 files changed, 14 insertions, 1 deletions
diff --git a/doc/tell.n b/doc/tell.n
index c9475ed..134ae36 100644
--- a/doc/tell.n
+++ b/doc/tell.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: tell.n,v 1.5 2001/09/14 19:20:40 andreas_kupries Exp $
+'\" RCS: @(#) $Id: tell.n,v 1.5.8.1 2004/10/27 14:43:14 dkf Exp $
'\"
.so man.macros
.TH tell n 8.1 Tcl "Tcl Built-In Commands"
@@ -34,6 +34,19 @@ Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR),
the return value from an invocation of \fBopen\fR or \fBsocket\fR, or
the result of a channel creation command provided by a Tcl extension.
.VE
+.SH EXAMPLE
+Read a line from a file channel only if it starts with \fBfoobar\fR:
+.CS
+# Save the offset in case we need to undo the read...
+set offset [\fBtell\fR $chan]
+if {[read $chan 6] eq "foobar"} {
+ gets $chan line
+} else {
+ set line {}
+ # Undo the read...
+ seek $chan $offset
+}
+.CE
.SH "SEE ALSO"
file(n), open(n), close(n), gets(n), seek(n), Tcl_StandardChannels(3)