eof is, in one sense, a command:
http://purl.org/tcl/home/man/tcl8.4/TclCmd/eof.htm
and, in another sense, an acronym for End Of File.
Programmers can use eof to determine whether the channel has reached the end of input.
Note that it fires only after the last successful gets, so testing for a -1 return value on gets may be a better idea, and avoid eof's FMM [L1 ] by coding:
while {[gets $fp line]>=0} {...}
instead of
while {![eof $fp]} { gets $fp line if [eof $fp break] ;# otherwise loops one time too many ... } ;# RS
Can anyone indicate whether there are certain types of channels (pipe, socket, etc.) where eof doesn't do what one might at first blush expect?
Tcl syntax help - Arts and crafts of Tcl-Tk programming - Category Command