Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to run prog & redirect stdout to window

Status
Not open for further replies.

RowdyOne

Programmer
Jul 14, 2001
2
US
Help!

I am trying to execute a program with switches in the /usr/bin of my linux system using a tk script. I try to exec filename -fl -a. and prints cant find file. But if I use exec filename it asks for the -a command. I have tried {} {} "" and ''. Any Ideas?
Also the next prob I have is I need to figure out how to make all the output from the prog I am running to go to the .console window I created.
Thanks for any suggestions

GReg R
 
I searched for about 45 minutes how to do this, didn't find ONE post. But I got a hint from a post that if stdout was closed, a library would fail.

The trick is stdout MUST BE closed prior to reassigning.
This works with standard TCL. This will work in libraries after reassign is done.

Sample code :
===========================================================

global stdout stderr

puts "Normal stdout puts"
puts stdout "Specified stdout puts"
close stdout
set stdout [open "temp.txt" w]
puts "redirected NORMAL puts"
puts stdout "redirected stdout specified"

puts stderr "Specified stderr puts"

close stderr

set stderr [open "error.txt" w]
puts stderr "Redirected stderr puts"

ThisInvalidCommandWillBeDirectedTo stderr


# Note, the last "std" I/O is stdin
#
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top