Re: (newbie) storing outputs from all lines of procs into a string
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: (newbie) storing outputs from all lines of procs into a string

From: <just80n@gmail.com>
Date: Wed Dec 21 2005 - 18:32:43 CET

Here is my last version of DYN_ex ...

proc DYN_ex args \
   {
      global OUTPUT
      set OUTPUT ""
      set COMMAND ""
      foreach arg $args {append COMMAND $arg;append COMMAND " "}
      set COMMAND [string trim $COMMAND]
      rename puts _puts
      proc puts args { append ::OUTPUT $args "\n"; eval _puts $args}
if {[catch $COMMAND retoureval]} {
       set OUTPUT ""
       rename puts {}
       rename _puts puts
       return -code error $retoureval
    }
      rename puts {}
      rename _puts puts
append OUTPUT [join $retoureval " "]
      return $OUTPUT
   }

however when when I launch the choucroute proc (see my last message), I
still get

% DYN_ex choucroute
qdsfsd 33
qdsfsd 4444 4
{qdsfsd 33}
{qdsfsd 4444 4}
choucroute

append output [join $retoureval " "] does not help; I still get those
{ { { }} }

any idea ?

thanx!
Received on Fri Dec 23 19:02:49 2005