a tclcmd allows Tcl commands to be executed by a simple x <<
Tcl command syntax. The commands can be stacked, or
accumulated. Each time a linefeed is obtained, the command is
evaluated.
For example:
tclcmd cmd; cmd << "set a 1\n puts stdout $a"; cmd << "for {set i 0} {$i < 10} {incr i}" cmd << "{set a [expr $a+$i]; puts stdout $a}\n";
The full class is given by:
class tclcmd { public: char *result; /* The result of the previous command is placed here */ tclcmd(); ~tclcmd(); tclcmd& operator<<(char* cmd); };