Description: Read a line from an IO channel. Replaced by GETVAL for most applications.
Syntax: gets channelId ?varName?
Argument: open channel ID, variable names to place result
Returns: text string
See Also: GETVAL
Examples:
namespace eval
::ezsmtp {
global env
tcl_platform
}
GETVAL replaces gets in WebAccess Scripts. It is recommended to use GETVAL instead of gets. GETVAL reads values from Tags. The IO tags in WebAccess are updated by communications drivers reading field equipment. . Most users will only need the GETVAL action command to read values stored in tags
The gets command is supported only for advanced users needing to customize WebAccess using scripts. For most users, it is RECOMMENDED TO USE GETVAL.
gets
The gets command reads the next line from a user defined IO channel. This command would be used in WebAccess for extremely advanced applications. Gets reads the user defined IO, 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). If varName is omitted the line is returned as the result of the command. If varName is specified then the line is placed in the variable and the return value is a count of the number of characters returned.
If end of file occurs before an end of line, the command returns whatever input is available up to the end of file. If channelId 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 varName because of end-of-file or because of insufficient data in nonblocking 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.