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: Bryan Oakley <oakley@bardo.clearlight.com>
Date: Mon Dec 19 2005 - 15:51:11 CET

just80n@gmail.com wrote:
> Hello all!
>
> I have a custom interpreter which people will feed with groups of
> custom commands (procs ...). [I don't have power over the contents of
> the procs, but I can do smthg after or before each one]
>
> a proc looks typically like this :
>
> proc gimmedat {} {
> puts [date_fc -d]
> bid_uch_pinct ab
> puts [date_fc -h]
> bid_uch_pinct cd
> puts [date_fc -d]
> bid_uch_pinct ef
> puts [date_fc -h]
> }
>
>
> I'd like to grabb ALL the results outputed by a proc into a single
> string and send this to another place via a socket...

It sounds like all you need to do is redefine 'puts' to do it's normal
job as well as append the string to a buffer. Then you simply need to
flush the buffer when the proc is finished running.
Received on Fri Dec 23 19:02:09 2005