Find the answer to your Linux question:
Results 1 to 2 of 2
Hi everyone, I wonder if someone can help me: In order to implement a pipe, I redirected stdin into the pipe... close(0); dup(m[0]); ... My problem is, after i use ...
  1. #1
    Just Joined!
    Join Date
    Apr 2007
    Posts
    6

    help with input/output redirection

    Hi everyone, I wonder if someone can help me:

    In order to implement a pipe, I redirected stdin into the pipe...

    close(0);
    dup(m[0]);
    ...

    My problem is, after i use the pipe, I want to continue the execution, using stdin normally (reading from the keyboard just like before).

    But, even if close the pipe, I can not recover stdin to 0...

    How can I do this? please post the line of code that recovers it...

    Thank you very much

    HW

  2. #2
    Linux Newbie
    Join Date
    Sep 2005
    Location
    CZ
    Posts
    164
    If you do a
    Code:
    close(0)
    Do you try to do something like
    Code:
    open(0)
    again?
    Last edited by Lost_scrib; 05-07-2007 at 03:48 PM. Reason: Added something like to not get confused...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...