gets man page on OpenIndiana

Man page or keyword search:  
man Server   20441 pages
apropos Keyword Search (all sections)
Output format
OpenIndiana logo
[printable version]

gets(1T)		     Tcl Built-In Commands		      gets(1T)

______________________________________________________________________________

NAME
       gets - Read a line from a channel

SYNOPSIS
       gets channelId ?varName?
_________________________________________________________________

DESCRIPTION
       This  command reads the next line from channelId, returns everything in
       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 channel such as the Tcl │
       standard input channel (stdin), the return value from an invocation  of │
       open or socket, 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 the variable
       by that name and the return value is a count of the number  of  charac‐
       ters returned.

       If  end	of  file 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  nonblocking  mode	 and there is not a full line of input
       available, the command returns an empty string and does not consume any
       input.  If varName is specified and an empty string is returned in var‐
       Name because of end-of-file or because of  insufficient	data  in  non‐
       blocking	 mode,	then  the return count is -1.  Note that if varName is
       not specified then the end-of-file and no-full-line-available cases can
       produce the same results as if 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.

EXAMPLE
       This example reads a file one line at a time and prints it out with the
       current line number attached to the start of each line.

	      set chan [open "some.file.txt"]
	      set lineNumber 0
	      while {[gets $chan line] >= 0} {
		  puts "[incr lineNumber]: $line"
	      }
	      close $chan

SEE ALSO
       file(1T), eof(1T), fblocked(1T), Tcl_StandardChannels(3TCL)

KEYWORDS
       blocking, channel, end of file, end of line, line, nonblocking, read

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌────────────────────┬─────────────────┐
       │  ATTRIBUTE TYPE    │ ATTRIBUTE VALUE │
       ├────────────────────┼─────────────────┤
       │Availability	    │ runtime/tcl-8   │
       ├────────────────────┼─────────────────┤
       │Interface Stability │ Uncommitted     │
       └────────────────────┴─────────────────┘
NOTES
       Source for Tcl is available on http://opensolaris.org.

Tcl				      7.5			      gets(1T)
[top]

List of man pages available for OpenIndiana

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net