Hello, <br>
<br>
This one should be so easy - but I'm stumped... I need to redirect stdout from the following code to a file. The procedures "cmp" and "FlushEventQueue" are not under my control, so I cannot edit them in any way. Neither procedure returns stdout upon exiting. Also, this is tcl8.0 embedded in another application called Quartus.<br>
<br>
#**** BEGIN code from which i ****<br>
#**** need to redirect stdout ****<br>
<br>
while { [cmp is_running ] } {<br>
after 100 <br>
FlushEventQueue<br>
}<br>
<br>
#**** END code from which i ****<br>
#**** need to redirect stdout ****<br>
<br>
I've tried the following: <br>
* embedding all of it in a puts statement<br>
* embedding just FlushEventQueue in a puts statement <br>
* write the command to a var and use eval in a puts stmnt<br>
* using exec to divert stdout with ">&@ $LogFileID" <br>
<br>
the last one doesn't work because these are procedures, not processes, so exec fails. <br>
<br>
Any suggestions? Again, this really should not be so difficult. One thing I'd like to try is to reassign the stdout handle to a filehandle, so that while it is assigned to that file, ANY stdout goes to the file. <br>
<br>
I would like to avoid launching an extra process with just this piece of code (using > in dos), because this portion of code is dependent on lines upon lines of previous code., and well, it would just be so ugly. I mean, this has to be possible, right?<br>
<br>
thanks for your time, <br>
<br>
argo
<br>
This one should be so easy - but I'm stumped... I need to redirect stdout from the following code to a file. The procedures "cmp" and "FlushEventQueue" are not under my control, so I cannot edit them in any way. Neither procedure returns stdout upon exiting. Also, this is tcl8.0 embedded in another application called Quartus.<br>
<br>
#**** BEGIN code from which i ****<br>
#**** need to redirect stdout ****<br>
<br>
while { [cmp is_running ] } {<br>
after 100 <br>
FlushEventQueue<br>
}<br>
<br>
#**** END code from which i ****<br>
#**** need to redirect stdout ****<br>
<br>
I've tried the following: <br>
* embedding all of it in a puts statement<br>
* embedding just FlushEventQueue in a puts statement <br>
* write the command to a var and use eval in a puts stmnt<br>
* using exec to divert stdout with ">&@ $LogFileID" <br>
<br>
the last one doesn't work because these are procedures, not processes, so exec fails. <br>
<br>
Any suggestions? Again, this really should not be so difficult. One thing I'd like to try is to reassign the stdout handle to a filehandle, so that while it is assigned to that file, ANY stdout goes to the file. <br>
<br>
I would like to avoid launching an extra process with just this piece of code (using > in dos), because this portion of code is dependent on lines upon lines of previous code., and well, it would just be so ugly. I mean, this has to be possible, right?<br>
<br>
thanks for your time, <br>
<br>
argo