chan pending
Gives the count of bytes that wait in a buffer of a channel.
chan pending MODE CHAN
Description
With MODE input it gives the count of bytes of the input buffer that no read took yet, and with output the count of the output buffer, or -1 when the channel is not open for that side.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| MODE | input or output | required | The buffer. Values: |
| CHAN | channel | required | The channel. |
Returns
An integer.
Examples
% set f [open a.txt w]; chan close $f
> set f [open a.txt]
> set r [chan pending output $f]
> chan close $f
> set r
-1
Errors
% chan pending bogus stdin
bad mode "bogus": must be input or output
-errorcode TCL LOOKUP INDEX mode
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