Nп/п : 10 из 100
 От   : Helmut Giese                        2:5075/128        29 авг 23 14:53:05
 К    : Andreas Leitgeb                                       29 авг 23 15:55:01
 Тема : Re: How to use `dup` from TclX
----------------------------------------------------------------------------------
                                                                                 
@MSGID: <uopreih1oktkdtmjnch1ubqtdh1vrgqpgk@4ax.com>
ae625a55
@REPLY: <slrnueplmm.6epk.avl@logic.at> 36bde820
@REPLYADDR Helmut Giese <hgiese@ratiosoft.com>
@REPLYTO 2:5075/128 Helmut Giese
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID:
<uopreih1oktkdtmjnch1ubqtdh1vrgqpgk@4ax.com>
@RFC-References:
<cbhnei1nu5kfqveh27f4m48r61c8h8cudp@4ax.com> 1@dont-email.me> <slrnueplmm.6epk.avl@logic.at>
@TZUTC: 0200
@TID: FIDOGATE-5.12-ge4e8b94
Hi Rich and Andreas,
many thanks to both of you.
>
>I`d probably first dup the original stdout to a new filehandle (one-arg
>variant of dup returns new filehandle), then dup the file onto stdout,
>and finally (after "dumptree") dup the previously created filehandle 
>back to stdout.
>
>  set dfd [open $dumpfile w]
>  set origout [dup stdout]; # make backup of application`s stdout
>  dup $fdf stdout
>  dumptree "Hello World!"
>  close stdout; close $dfd ;#  I think you need to close both!
>  dup $origout stdout
>  close $origout  ;#  close the backup-fd of stout. no need to keep them both
>
Andreas` observation to close stdout, too, was spot on. With this
augmentation my original program works as expected.
And even preserving stdout works on Windows, albeit not within TkCon
(but that is understandable since TkCon does some magic with stdout).
Again many thanks
Helmut
--- Forte Free Agent 1.93/32.576 English (American)
 * Origin: ratiosoft (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх