diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-10-17 10:22:24 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-10-17 10:22:24 (GMT) |
commit | 842e3ff91428c72a2ce0d4df4889778af82f4b12 (patch) | |
tree | 5a94240e321022019f593f6bd712833ab12138c6 /doc/read.n | |
parent | 8b464633a0f2df93912ad25af65a5724cd643da2 (diff) | |
download | tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.zip tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.tar.gz tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.tar.bz2 |
Improve clarity of formatting.
Diffstat (limited to 'doc/read.n')
-rw-r--r-- | doc/read.n | 12 |
1 files changed, 6 insertions, 6 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.15 2007/12/13 15:22:33 dgp Exp $ +'\" RCS: @(#) $Id: read.n,v 1.16 2008/10/17 10:22:25 dkf Exp $ '\" .so man.macros .TH read n 8.1 Tcl "Tcl Built-In Commands" @@ -18,7 +18,6 @@ read \- Read from a channel .sp \fBread \fIchannelId numChars\fR .BE - .SH DESCRIPTION .PP In the first form, the \fBread\fR command reads all of the data from @@ -53,36 +52,37 @@ newline characters according to the \fB\-translation\fR option for the channel. See the \fBfconfigure\fR manual entry for a discussion on ways in which \fBfconfigure\fR will alter input. - .SH "USE WITH SERIAL PORTS" '\" Note: this advice actually applies to many versions of Tcl - +.PP For most applications a channel connected to a serial port should be configured to be nonblocking: \fBfconfigure \fIchannelId \fB\-blocking \fI0\fR. Then \fBread\fR behaves much like described above. Care must be taken when using \fBread\fR on blocking serial ports: .TP \fBread \fIchannelId numChars\fR +. In this form \fBread\fR blocks until \fInumChars\fR have been received from the serial port. .TP \fBread \fIchannelId\fR +. In this form \fBread\fR blocks until the reception of the end-of-file 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" +.PP 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: +.PP .CS set fl [open /proc/meminfo] set data [\fBread\fR $fl] close $fl set lines [split $data \en] .CE - .SH "SEE ALSO" file(n), eof(n), fblocked(n), fconfigure(n), Tcl_StandardChannels(3) - .SH KEYWORDS blocking, channel, end of line, end of file, nonblocking, read, translation, encoding |