chan flush

Writes the buffered output of a channel.

chan flush CHAN

Description

Writes each byte in the output buffer of CHAN to its file or device. A channel with no buffered output stays as it is.

Arguments

ArgumentTypeDefaultDescription
CHANchannelrequiredThe channel.

Returns

An empty string.

Examples

% set f [open b.txt w]
> chan puts -nonewline $f x
> chan flush $f
> set s [file size b.txt]
> chan close $f
> set s
1

Errors

% chan flush 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