Prev: How to call a tcl script (proc) from a vb.net.
Next: Tcl/TK has no 'goto', because everything is a string
From: pmarin on 22 Dec 2009 06:42 I often need to redirect a tcl function/command that write to the stdout, to another channel. For example if I want to convert the output of a command to a string (It could be very easy to do If I can do channel redirection). How can I do it? Example: Imagine the command "toString": >set output [toString { puts "hello"} ] >set output "hello" Cheers. Happy Christmas! pmarin.
From: Jan Kandziora on 22 Dec 2009 09:26
pmarin schrieb: > I often need to redirect a tcl function/command that write to the > stdout, to another channel. > For example if I want to convert the output of a command to a string > (It could be very easy to do If I can do channel redirection). > How can I do it? > If you only need to capture puts (not fcopy or others), easiest way is to redefine the puts procedure. See http://wiki.tcl.tk/8502 for an example which redirects all puts output to a text widget. Kind regards Jan |