1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1993 The Regents of the University of California.
|
3 |
|
|
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
4 |
|
|
'\"
|
5 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
6 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
7 |
|
|
'\"
|
8 |
|
|
'\" RCS: @(#) $Id: read.n,v 1.1.1.1 2002-01-16 10:25:25 markom Exp $
|
9 |
|
|
'\"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.TH read n 7.5 Tcl "Tcl Built-In Commands"
|
12 |
|
|
.BS
|
13 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
14 |
|
|
.SH NAME
|
15 |
|
|
read \- Read from a channel
|
16 |
|
|
.SH SYNOPSIS
|
17 |
|
|
\fBread \fR?\fB\-nonewline\fR? \fIchannelId\fR
|
18 |
|
|
.sp
|
19 |
|
|
\fBread \fIchannelId numBytes\fR
|
20 |
|
|
.BE
|
21 |
|
|
|
22 |
|
|
.SH DESCRIPTION
|
23 |
|
|
.PP
|
24 |
|
|
In the first form, the \fBread\fR command reads all of the data from
|
25 |
|
|
\fIchannelId\fR up to the end of the file.
|
26 |
|
|
If the \fB\-nonewline\fR switch is specified then the last character
|
27 |
|
|
of the file is discarded if it is a newline.
|
28 |
|
|
In the second form, the extra argument specifies how many bytes to
|
29 |
|
|
read. Exactly that many bytes will be read and returned, unless
|
30 |
|
|
there are fewer than \fInumBytes\fR left in the file; in this case
|
31 |
|
|
all the remaining bytes are returned.
|
32 |
|
|
.PP
|
33 |
|
|
If \fIchannelId\fR is in nonblocking mode, the command may not read
|
34 |
|
|
as many bytes as requested: once all available input has been read,
|
35 |
|
|
the command will return the data that is available rather than blocking
|
36 |
|
|
for more input.
|
37 |
|
|
The \fB\-nonewline\fR switch is ignored if the command returns
|
38 |
|
|
before reaching the end of the file.
|
39 |
|
|
.PP
|
40 |
|
|
\fBRead\fR translates end-of-line sequences in the input into
|
41 |
|
|
newline characters according to the \fB\-translation\fR option
|
42 |
|
|
for the channel.
|
43 |
|
|
See the manual entry for \fBfconfigure\fR for details on the
|
44 |
|
|
\fB\-translation\fR option.
|
45 |
|
|
|
46 |
|
|
.SH "SEE ALSO"
|
47 |
|
|
eof(n), fblocked(n), fconfigure(n)
|
48 |
|
|
|
49 |
|
|
.SH KEYWORDS
|
50 |
|
|
blocking, channel, end of line, end of file, nonblocking, read, translation
|