Seth Woolley's Man Viewer

Manual for gets - man n gets

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

gets(3,n)(n)                      Tcl Built-In Commands                     gets(3,n)(n)



NAME
       gets(3,n) - Read a line from a channel

SYNOPSIS
       gets(3,n) channelId ?varName?


DESCRIPTION
       This  command reads the next line from channelId, returns everything in(1,8)
       the line up to (but not including) the  end-of-line  character(s),  and
       discards the end-of-line character(s).

       ChannelId  must  be  an  identifier for an open(2,3,n) channel such as the Tcl
       standard input channel (stdin), the return value from an invocation  of
       open(2,3,n) or socket(2,7,n), or the result of a channel creation command provided by
       a Tcl extension. The channel must have been opened for input.

       If varName is omitted the line is returned as the result  of  the  com-
       mand.   If varName is specified then the line is placed in(1,8) the variable
       by that name and the return value is a count of the number  of  charac-
       ters returned.

       If  end  of  file(1,n) occurs while scanning for an end of line, the command
       returns whatever input is available up to the end of  file.   If  chan-
       nelId  is  in(1,8)  nonblocking  mode  and there is not a full line of input
       available, the command returns an empty string(3,n) and does not consume any
       input.  If varName is specified and an empty string(3,n) is returned in(1,8) var-
       Name because of end-of-file or because of  insufficient  data  in(1,8)  non-
       blocking  mode,  then  the return count is -1.  Note that if(3,n) varName is
       not specified then the end-of-file and no-full-line-available cases can
       produce the same results as if(3,n) there were an input line consisting only
       of the end-of-line character(s).  The eof and fblocked commands can  be
       used to distinguish these three cases.


SEE ALSO
       file(1,n)(n), eof(n), fblocked(n), Tcl_StandardChannels(3)


KEYWORDS
       blocking, channel, end of file(1,n), end of line, line, nonblocking, read(2,n,1 builtins)



Tcl                                   7.5                              gets(3,n)(n)

References for this manual (incoming links)