Tcl Source Code

Artifact [e77c92fe98]
Login

Artifact e77c92fe980141519392c3e66803b85e73fe38bb:

Attachment "gets.diff" to ticket [935911ffff] added by davidw 2004-04-16 03:34:50.
Index: gets.n
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/gets.n,v
retrieving revision 1.4
diff -u -r1.4 gets.n
--- gets.n	14 Sep 2001 19:20:40 -0000	1.4
+++ gets.n	15 Apr 2004 20:15:46 -0000
@@ -52,6 +52,17 @@
 The \fBeof\fR and \fBfblocked\fR commands can be used to distinguish
 these three cases.
 
+.SH "EXAMPLE"
+This example reads a file, line by line.
+
+.CS
+set fl [open somefile]
+while { [gets $fl line] >= 0 } {
+    ... code ...
+}
+.CE
+
+
 .SH "SEE ALSO"
 file(n), eof(n), fblocked(n), Tcl_StandardChannels(3)