How to change default stdin to a process?

Discussion in 'C Programming' started by sudheer2510, May 6, 2011.

  1. sudheer2510

    sudheer2510

    Joined:
    May 6, 2011
    Messages:
    1
    Hi,

    I have two processes (one written in tcl (wish process) and the other is a C Program (a.out))
    I am opening the second process as a sub process from wish process by using pipe as follows

    set pipe [open "| sh -c { $execCommand } " r+ ]

    So, when i want to send a message to process 2, i can use "puts $pipe <message>" and the message can be received at process2 at fd 0 . i.e., "read(0,buff,size) in process2"

    Now my query is "How to change that default fd 0 at receiving side? i.e., I want to receive the message when I give read((5,buff,size)) on process2???"

    Thanks in Advance,
    rAzoRbaCK
     
    sudheer2510, May 6, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Johnathan Doe

    peek at stdin, flush stdin

    Johnathan Doe, May 15, 2004, in forum: C Programming
    Replies:
    5
    Views:
    25,029
    Chatoyer
    May 17, 2013
  2. Charlie Zender

    Reading stdin once confuses second stdin read

    Charlie Zender, Jun 19, 2004, in forum: C Programming
    Replies:
    6
    Views:
    793
    Dan Pop
    Jun 21, 2004
  3. Ben
    Replies:
    2
    Views:
    1,349
    jacob navia
    Aug 29, 2009
  4. Terry Cooper
    Replies:
    7
    Views:
    427
    Janos Sebok
    Jun 9, 2009
  5. Stefano Sabatini
    Replies:
    6
    Views:
    295
    Stefano Sabatini
    Jul 29, 2007
Loading...

Share This Page