Tcl 8.3 had a problem on stdout, when it was redirected to a file. The problem was that every buffer write caused a flush of the disk cache. The workaround in 8.3 was to do (once, at beginning of script):
LV anyone want to address the situation with stdio and Windows? Are the file handles available by default? What do you have to do to see the output going to stdout?BR - 2003-12-14 - Are you asking about wish.exe? tclsh.exe does have a normal stdout like any Windows console application.wish.exe on Windows doesn't have Windows-level stdout, stderr or stdin. That is a consequence of being a Windows GUI app.With 8.4, you should be able to use tclsh.exe instead, if you want a GUI and console I/O at the same time. You need to add a package require Tk to the top of your script to load Tk as an extension, unless the script already has that. That statement doesn't do any harm if the script is actually executed in wish.exe, so you don't need a separate script for this.You can also call console show from a script running in wish.exe (check first if the console command exists, if you want to be portable). That gives you the normal interaction window as used in interactive Wish sessions in addition to your application. It will also show any output that you write to the stdout and stderr Tcl channels.escargo 28 Dec 2003 - So [info commands console] will return console if that command exists. However, what info subcommand can tell me if stdout is defined? There is no info channels that I can find. Determining if stdout is defined should a reasonable piece of introspection that can be done. How do I do it?Lars H: Strangely enough, it's file channels, not info channels.
redefining stdout
fconfigure stdout -buffering full -buffersize 262144so that there were few disk writes performed. (Thanks KBK and the Tcl chatroom for the quick answer! RS)
LV anyone want to address the situation with stdio and Windows? Are the file handles available by default? What do you have to do to see the output going to stdout?BR - 2003-12-14 - Are you asking about wish.exe? tclsh.exe does have a normal stdout like any Windows console application.wish.exe on Windows doesn't have Windows-level stdout, stderr or stdin. That is a consequence of being a Windows GUI app.With 8.4, you should be able to use tclsh.exe instead, if you want a GUI and console I/O at the same time. You need to add a package require Tk to the top of your script to load Tk as an extension, unless the script already has that. That statement doesn't do any harm if the script is actually executed in wish.exe, so you don't need a separate script for this.You can also call console show from a script running in wish.exe (check first if the console command exists, if you want to be portable). That gives you the normal interaction window as used in interactive Wish sessions in addition to your application. It will also show any output that you write to the stdout and stderr Tcl channels.escargo 28 Dec 2003 - So [info commands console] will return console if that command exists. However, what info subcommand can tell me if stdout is defined? There is no info channels that I can find. Determining if stdout is defined should a reasonable piece of introspection that can be done. How do I do it?Lars H: Strangely enough, it's file channels, not info channels.
redefining stdout