summaryrefslogtreecommitdiffstats
path: root/doc/gets.n
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2004-10-27 12:52:31 (GMT)
committerdkf <dkf@noemail.net>2004-10-27 12:52:31 (GMT)
commit46669897decc1c69eb2226d713c9ddaa026431ec (patch)
tree3ed6ba33b7a0eb1bb7d89c83f86bb2f420d5284a /doc/gets.n
parent739cb7dee1505acf27c9efe8995d76ecbf76a098 (diff)
downloadtcl-46669897decc1c69eb2226d713c9ddaa026431ec.zip
tcl-46669897decc1c69eb2226d713c9ddaa026431ec.tar.gz
tcl-46669897decc1c69eb2226d713c9ddaa026431ec.tar.bz2
More doc fix backporting
FossilOrigin-Name: 63610c2fd0b97f8b6c13c39e453c7b7fcc8decc2
Diffstat (limited to 'doc/gets.n')
-rw-r--r--doc/gets.n14
1 files changed, 13 insertions, 1 deletions
diff --git a/doc/gets.n b/doc/gets.n
index f884d11..9c8c5db 100644
--- a/doc/gets.n
+++ b/doc/gets.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: gets.n,v 1.4 2001/09/14 19:20:40 andreas_kupries Exp $
+'\" RCS: @(#) $Id: gets.n,v 1.4.8.1 2004/10/27 12:52:40 dkf Exp $
'\"
.so man.macros
.TH gets n 7.5 Tcl "Tcl Built-In Commands"
@@ -51,6 +51,18 @@ produce the same results as if there were an input line consisting
only of the end-of-line character(s).
The \fBeof\fR and \fBfblocked\fR commands can be used to distinguish
these three cases.
+.SH "EXAMPLE"
+This example reads a file one line at a time and prints it out with
+the current line number attached to the start of each line.
+.PP
+.CS
+set chan [open "some.file.txt"]
+set lineNumber 0
+while {[\fBgets\fR $chan line] >= 0} {
+ puts "[incr lineNumber]: $line"
+}
+close $chan
+.CE
.SH "SEE ALSO"
file(n), eof(n), fblocked(n), Tcl_StandardChannels(3)