• Re: Bidirectional open?

    From Rich@21:1/5 to saito on Wed May 22 19:32:17 2024
    saito <[email protected]> wrote:
    When you use a open/pipe command like [open "| xyz ...]", is it possible
    to configure it in both read and write modes? So I can write to it to
    send info to xyz and read its output?

    This is trivial for you to discover on your own:

    $ rlwrap tclsh
    % set fd [open "|cat -" {RDWR}]
    file5
    % fconfigure $fd -buffering none
    % puts $fd hello
    % gets $fd
    hello
    % exit

    Note that the '-buffering none' is to be sure that the first puts of
    'hello' got flushed to cat to be returned.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From et99@21:1/5 to saito on Thu May 23 12:05:42 2024
    On 5/22/2024 12:38 PM, saito wrote:
    On 5/22/2024 3:32 PM, Rich wrote:
    saito <[email protected]> wrote:
    When you use a open/pipe command like [open "| xyz ...]", is it possible >>> to configure it in both read and write modes? So I can write to it to
    send info to xyz and read its output?

    This is trivial for you to discover on your own:


    You are right; give it to mental fog.

    Thank you.




    I have been using the gemini AI (gemini.google.com) a lot more lately, since I was surprised by how well it knows Tcl coding.

    I gave it the same question from your first post, and then I provided the text of this thread and asked it what it thought about it.

    It then said:

    "I'd be glad to provide a response that incorporates the best aspects of previous responses, addresses potential issues, and aims to be superior to a human response that might be dismissive:"

    It followed that up with some info on buffering in tcl pipes, and a complete explanation of this thread's responses, and some recommendations.

    The only thing it left out was,

    I'll be back!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)