Tcl Source Code

Artifact [7b218a1ede]
Login

Artifact 7b218a1edec35acd9d7d2d5db8e04e83a01c7ad1:

Attachment "read.diff" to ticket [938056ffff] added by davidw 2004-04-19 23:56:04.
Index: read.n
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/read.n,v
retrieving revision 1.7
diff -u -r1.7 read.n
--- read.n	14 Sep 2001 19:20:40 -0000	1.7
+++ read.n	19 Apr 2004 16:33:48 -0000
@@ -74,6 +74,16 @@
 character has been configured for the channel, then \fBread\fR will
 block forever.
 
+.SH "EXAMPLE"
+This example code reads a file all at once, and splits it into a list,
+with each line corresponding to an element in the list:
+
+.CS
+set fl [open /proc/meminfo]
+set data [read $fl]
+close $fl
+set lines [split $data \\n]
+.CE
 
 .SH "SEE ALSO"
 file(n), eof(n), fblocked(n), fconfigure(n), Tcl_StandardChannels(3)