Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. pipe(p) // create a new pipe with two handles p[0] and p[1]
  2. fork() // spawn a child process
  3. close(p[0]) // close the write end of the pipe in the child
  4. dup2(p[1], 0) // duplicate the pipe descriptor on top of fd 0 (stdin)
  5. close(p[1]) // close the other pipe descriptor
  6. exec() // run a new process with the new descriptors in place
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement