Many times people want to do things like run a program feeding it information, or doing some setup, then running a command and doing something with its output, or writing a Tk wrapper for a text only command. Here's an example of wrapping the '''bc''' arbitrary precision arithmetic language calculator in Tcl. This might provide one with longer precision math without implementing one of the extensions discussed in [Arbitrary Precision Math Procedures]. #! /usr/tcl84/bin/tclsh # Program: bcfe # Date: Jan 27, 2003 # Version: 1.1 set fe [open "|/bin/bc -l" "r+"] fconfigure $fe -buffering none puts "Enter expression:" set ex 1 puts -nonewline "bc $ex> " flush stdout while { [gets stdin input] >= 0 } { if { $input == "quit" } { break } puts $fe "$input" flush $fe incr ex gets $fe newans puts "Answer is: $newans" puts -nonewline "bc $ex> " flush stdout } ---- [Category Application]