| 1 |
'\" |
| 2 |
'\" Copyright (c) 1993 The Regents of the University of California. |
| 3 |
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 4 |
'\" |
| 5 |
'\" See the file "license.terms" for information on usage and redistribution |
| 6 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 7 |
'\" |
| 8 |
.TH flush n 7.5 Tcl "Tcl Built-In Commands" |
| 9 |
.so man.macros |
| 10 |
.BS |
| 11 |
'\" Note: do not modify the .SH NAME line immediately below! |
| 12 |
.SH NAME |
| 13 |
flush \- Flush buffered output for a channel |
| 14 |
.SH SYNOPSIS |
| 15 |
\fBflush \fIchannelId\fR |
| 16 |
.BE |
| 17 |
.SH DESCRIPTION |
| 18 |
.PP |
| 19 |
Flushes any output that has been buffered for \fIchannelId\fR. |
| 20 |
.PP |
| 21 |
\fIChannelId\fR must be an identifier for an open channel such as a |
| 22 |
Tcl standard channel (\fBstdout\fR or \fBstderr\fR), the return |
| 23 |
value from an invocation of \fBopen\fR or \fBsocket\fR, or the result |
| 24 |
of a channel creation command provided by a Tcl extension. The |
| 25 |
channel must have been opened for writing. |
| 26 |
.PP |
| 27 |
If the channel is in blocking mode the command does not return until all the |
| 28 |
buffered output has been flushed to the channel. If the channel is in |
| 29 |
nonblocking mode, the command may return before all buffered output has been |
| 30 |
flushed; the remainder will be flushed in the background as fast as the |
| 31 |
underlying file or device is able to absorb it. |
| 32 |
.SH EXAMPLE |
| 33 |
.PP |
| 34 |
Prompt for the user to type some information in on the console: |
| 35 |
.PP |
| 36 |
.CS |
| 37 |
puts -nonewline "Please type your name: " |
| 38 |
\fBflush\fR stdout |
| 39 |
gets stdin name |
| 40 |
puts "Hello there, $name!" |
| 41 |
.CE |
| 42 |
.SH "SEE ALSO" |
| 43 |
file(n), open(n), socket(n), Tcl_StandardChannels(3) |
| 44 |
.SH KEYWORDS |
| 45 |
blocking, buffer, channel, flush, nonblocking, output |