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: gets.n,v 1.1.1.1 2002-01-16 10:25:24 markom Exp $
|
9 |
|
|
'\"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.TH gets 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 |
|
|
gets \- Read a line from a channel
|
16 |
|
|
.SH SYNOPSIS
|
17 |
|
|
\fBgets \fIchannelId\fR ?\fIvarName\fR?
|
18 |
|
|
.BE
|
19 |
|
|
|
20 |
|
|
.SH DESCRIPTION
|
21 |
|
|
.PP
|
22 |
|
|
This command reads the next line from \fIchannelId\fR, returns everything
|
23 |
|
|
in the line up to (but not including) the end-of-line character(s), and
|
24 |
|
|
discards the end-of-line character(s).
|
25 |
|
|
If \fIvarName\fR is omitted the line is returned as the result of the
|
26 |
|
|
command.
|
27 |
|
|
If \fIvarName\fR is specified then the line is placed in the variable by
|
28 |
|
|
that name and the return value is a count of the number of characters
|
29 |
|
|
returned.
|
30 |
|
|
.PP
|
31 |
|
|
If end of file occurs while scanning for an end of
|
32 |
|
|
line, the command returns whatever input is available up to the end of file.
|
33 |
|
|
If \fIchannelId\fR is in nonblocking mode and there is not a full
|
34 |
|
|
line of input available, the command returns an empty string and
|
35 |
|
|
does not consume any input.
|
36 |
|
|
If \fIvarName\fR is specified and an empty string is returned in
|
37 |
|
|
\fIvarName\fR because of end-of-file or because of insufficient
|
38 |
|
|
data in nonblocking mode, then the return count is -1.
|
39 |
|
|
Note that if \fIvarName\fR is not specified then the end-of-file
|
40 |
|
|
and no-full-line-available cases can
|
41 |
|
|
produce the same results as if there were an input line consisting
|
42 |
|
|
only of the end-of-line character(s).
|
43 |
|
|
The \fBeof\fR and \fBfblocked\fR commands can be used to distinguish
|
44 |
|
|
these three cases.
|
45 |
|
|
|
46 |
|
|
.SH "SEE ALSO"
|
47 |
|
|
eof(n), fblocked(n)
|
48 |
|
|
|
49 |
|
|
.SH KEYWORDS
|
50 |
|
|
blocking, channel, end of file, end of line, line, nonblocking, read
|