The UNIX and Linux Forums
>
Top Forums
>
High Level Programming
How to clear the content of a pipe (STDIN) after it is written to another program?
User Name
Remember Me?
Password
Google UNIX.COM
Forums
Portal
Register
Rules & FAQ
Contribute
Members List
Arcade
Search
Today's Posts
Mark Forums Read
Thread
:
How to clear the content of a pipe (STDIN) after it is written to another program?
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
#
2
(
permalink
)
05-14-2008
shamrock
Registered User
Join Date: Oct 2007
Location: USA
Posts: 500
Re-direct STDIN
Before reading data on the second pipe the parent process needs to redirect its standard input to fd2[0].
Code:
dup2(fd2[0], STDIN_FILENO);
shamrock
View Public Profile
Find all posts by shamrock