diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-04-19 22:47:36 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-04-19 22:47:36 (GMT) |
commit | 354d7f73aad4cceb29dd5f6596df5471d658b54b (patch) | |
tree | 0e88288d50e319697eab2dfa8e41c85adba9a352 /doc | |
parent | fcbc95ab79f792de67d4209c721c992def184483 (diff) | |
download | tcl-354d7f73aad4cceb29dd5f6596df5471d658b54b.zip tcl-354d7f73aad4cceb29dd5f6596df5471d658b54b.tar.gz tcl-354d7f73aad4cceb29dd5f6596df5471d658b54b.tar.bz2 |
Added example from David Welton. [Patch 938056]
Diffstat (limited to 'doc')
-rw-r--r-- | doc/read.n | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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: read.n,v 1.7 2001/09/14 19:20:40 andreas_kupries Exp $ +'\" RCS: @(#) $Id: read.n,v 1.8 2004/04/19 22:47:37 dkf Exp $ '\" .so man.macros .TH read n 8.1 Tcl "Tcl Built-In Commands" @@ -74,6 +74,16 @@ character, see \fBfconfigure -eofchar\fR. If there no end-of-file 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 in the file 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) |