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.
Start with dup . You really need to look a little harder. There is a lot of material on this.
. UNIX- dup() dup2() ; , exec -ed. , fork , 0, 1 2 , exec() .
dup()
dup2()
exec
fork
exec()
My favorite forkpty . This function returns a child and gives you a file descriptor for its stdin / stdout. You can use exec after forking,