summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-05-17 15:16:05 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-05-17 15:16:05 (GMT)
commit75b04e4a226527d290affcdb2ed3ef4e8982b868 (patch)
treebd7316900a687f387c100700458d93de99f8ac75 /doc
parentca9f53824153cabd6f7cf69459b76b2abfff52db (diff)
downloadtcl-75b04e4a226527d290affcdb2ed3ef4e8982b868.zip
tcl-75b04e4a226527d290affcdb2ed3ef4e8982b868.tar.gz
tcl-75b04e4a226527d290affcdb2ed3ef4e8982b868.tar.bz2
Example updates/additions.
Diffstat (limited to 'doc')
-rw-r--r--doc/list.n9
-rw-r--r--doc/seek.n23
2 files changed, 27 insertions, 5 deletions
diff --git a/doc/list.n b/doc/list.n
index ec32108..4cb356b 100644
--- a/doc/list.n
+++ b/doc/list.n
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: list.n,v 1.8 2003/08/11 13:26:13 dkf Exp $
+'\" RCS: @(#) $Id: list.n,v 1.9 2004/05/17 15:16:13 dkf Exp $
'\"
.so man.macros
.TH list n "" Tcl "Tcl Built-In Commands"
@@ -29,13 +29,14 @@ so that \fBeval\fR may be used to execute the resulting list, with
its arguments. \fBList\fR produces slightly different results than
\fBconcat\fR: \fBconcat\fR removes one level of grouping before forming
the list, while \fBlist\fR works directly from the original arguments.
-For example, the command
+.SH EXAMPLE
+The command
.CS
-\fBlist a b {c d e} {f {g h}}\fR
+list a b "c d e " " f {g h}"
.CE
will return
.CS
-\fBa b {c d e} {f {g h}}\fR
+\fBa b {c d e } { f {g h}}\fR
.CE
while \fBconcat\fR with the same arguments will return
.CS
diff --git a/doc/seek.n b/doc/seek.n
index 5f3118a..163f203 100644
--- a/doc/seek.n
+++ b/doc/seek.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: seek.n,v 1.5 2001/09/14 19:20:40 andreas_kupries Exp $
+'\" RCS: @(#) $Id: seek.n,v 1.6 2004/05/17 15:16:14 dkf Exp $
'\"
.so man.macros
.TH seek n 8.1 Tcl "Tcl Built-In Commands"
@@ -62,6 +62,27 @@ Note that \fIoffset\fR values are byte offsets, not character
offsets. Both \fBseek\fR and \fBtell\fR operate in terms of bytes,
not characters, unlike \fBread\fR.
.VE 8.1
+.SH EXAMPLES
+Read a file twice:
+.CS
+set f [open file.txt]
+set data1 [read $f]
+seek $f 0
+set data2 [read $f]
+close $f
+# $data1 == $data2 if the file wasn't updated
+.CE
+
+Read the last 10 bytes from a file:
+.CS
+set f [open file.data]
+# This is guaranteed to work with binary data but
+# may fail with other encodings...
+fconfigure $f -translation binary
+seek $f -10 end
+set data [read $f 10]
+close $f
+.CE
.SH "SEE ALSO"
file(n), open(n), close(n), gets(n), tell(n), Tcl_StandardChannels(3)