From: utzoo!decvax!decwrl!sun!megatest!fortune!hpda!hplabs!sri-unix!mark.umcp-cs@UDel-Relay Newsgroups: net.unix-wizards Title: controlling standard input in a forked process Article-I.D.: sri-arpa.907 Posted: Thu Mar 31 15:41:35 1983 Received: Tue Apr 19 06:03:28 1983 From: Mark Weiser Date: 28 Mar 1983 0340-PST Just fork off the child with a pipe connected to standard input, and the other end of the pipe under the control of the parent. Use dup2() to move the pipe file descripter to 0 (which is standard in) after the fork but before the exec. Make sure to close all unused descripters in each process to make things clean.