Originally Posted by
Elkvis
you probably don't need to call dup2() in the parent process, because it would then take the place of your existing stdout, unless that's exactly what you're going for. otherwise, what you've got there is pretty much right on. if you want to hook up both stdin and stdout, you'll need to call pipe() with another pair of ints, and hook them up exactly the opposite of the others. make sure to close the unused end of the pipe in each process - close(fd[1]) in the child, and close(fd[0]) in the parent.