gets(n) Tcl Built-In Commands gets(n) _________________________________________________________________ NAME gets - Read a line from a channel SYNOPSIS gets _c_h_a_n_n_e_l_I_d ?_v_a_r_N_a_m_e? _________________________________________________________________ DESCRIPTION This command reads the next line from _c_h_a_n_n_e_l_I_d, 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 _v_a_r_N_a_m_e is omitted the line is returned as the result of the command. If _v_a_r_N_a_m_e is specified then the line is placed in the variable by that name and the return value is a count of the number of characters 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 _c_h_a_n_n_e_l_I_d 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 _v_a_r_N_a_m_e is speci- fied and an empty string is returned in _v_a_r_N_a_m_e because of end-of-file or because of insufficient data in nonblocking mode, then the return count is -1. Note that if _v_a_r_N_a_m_e 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. SEE ALSO eof(n), fblocked(n) KEYWORDS blocking, channel, end of file, end of line, line, nonblock- ing, read Tcl Last change: 7.5 1