Redirecting input and output of a child process in C

I want to write a program c in which I create several child processes and redirect their inputs and outputs to different file descriptors. I searched a lot, but could not find the relevant results. Please, help.

+3
source share
3 answers

Start with dup . You really need to look a little harder. There is a lot of material on this.

+3
source

. UNIX- dup() dup2() ; , exec -ed. , fork , 0, 1 2 , exec() .

+2

My favorite forkpty . This function returns a child and gives you a file descriptor for its stdin / stdout. You can use exec after forking,

+1
source

All Articles