 <p>The <a href="http://www.tcl.tk/man/tcl8.6/TclCmd/flush.htm" rel="nofollow"><code>flush</code></a> command directs Tcl to ensure all its buffered output for a channel is written to the underlying operating system immediately. You hardly ever need to use <code>flush</code> explicitly; the main exception is when you are prompting the user for input without using a new line:</p> <pre><code>puts -nonewline "Please enter your name: " flush stdout set name [gets stdin] </code></pre> <p>However, if you are having problems with flushing for other reasons, you actually need to use <a href="http://www.tcl.tk/man/tcl8.6/TclCmd/fconfigure.htm" rel="nofollow"><code>fconfigure</code></a> to change the default output buffer management strategy:</p> <pre><code># Turn off output buffering fconfigure $channel -buffering none </code></pre> <p>Every channel supports three buffering strategies:</p> <ul> <li><code>none</code> — no buffering at all.</li> <li><code>full</code> — buffer until a full output buffer is built up (the output buffer size is controllable but you hardly ever need to touch it) and then write that whole buffer at once.</li> <li><code>line</code> — buffer until a full line of output can be written at once.</li> </ul> <p>Most channels default to <code>full</code> as that gives the best performance when writing bulk data, but the <code>stdout</code> channel defaults to <code>line</code> when writing to a terminal, and the <code>stderr</code> channel <em>always</em> defaults to <code>none</code> (as it is used for writing messages when the system is very poorly and might crash, among other things).</p>