chan eof

Tests whether the last read reached the end of a channel.

chan eof CHAN

Description

Gives 1 when the last read of CHAN met the end of its data, else 0. A new channel gives 0 until a read meets the end.

Arguments

ArgumentTypeDefaultDescription
CHANchannelrequiredThe channel.

Returns

1 or 0.

Examples

% set f [open a.txt w]; chan puts $f hello; chan close $f
> set f [open a.txt]
> chan read $f
> set e [chan eof $f]
> chan close $f
> set e
1

Errors

% chan eof nochan
can not find channel named "nochan"
-errorcode TCL LOOKUP CHANNEL nochan

Facts

Capability
channels. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also