Question is extension of what is answered in link. While trying to use it to print output with delay, cat file_name
on the shell doesn't display the content of the file during the delay time using after
. Here's the code:
proc foo {times} {
while {$times >0} {
puts "hello$times"
incr times -1
after 20000
puts "hello world"
}
}
proc reopenStdout {file} {
close stdout
open $file w ;# The standard channels are special
}
reopenStdout ./bar
foo 10