read(n) Tcl Built-In Commands read(n) _________________________________________________________________ NAME read - Read from a channel SYNOPSIS read ?-nonewline? _c_h_a_n_n_e_l_I_d read _c_h_a_n_n_e_l_I_d _n_u_m_B_y_t_e_s _________________________________________________________________ DESCRIPTION In the first form, the read command reads all of the data from _c_h_a_n_n_e_l_I_d up to the end of the file. If the -nonewline switch is specified then the last character of the file is discarded if it is a newline. In the second form, the extra argument specifies how many bytes to read. Exactly that many bytes will be read and returned, unless there are fewer than _n_u_m_B_y_t_e_s left in the file; in this case all the remaining bytes are returned. If _c_h_a_n_n_e_l_I_d is in nonblocking mode, the command may not read as many bytes as requested: once all available input has been read, the command will return the data that is available rather than blocking for more input. The -nonew- line switch is ignored if the command returns before reach- ing the end of the file. Read translates end-of-line sequences in the input into new- line characters according to the -translation option for the channel. See the manual entry for fconfigure for details on the -translation option. SEE ALSO eof(n), fblocked(n), fconfigure(n) KEYWORDS blocking, channel, end of line, end of file, nonblocking, read, translation Tcl Last change: 7.5 1