1

I have 2 files: main and the one I call with exec. I created a fork() and inside used exec call to C file, how can I access pipe from this exec file, so output of exec will be written to parent pipe?

Yerni
  • 55
  • 4
  • 1
    You will have to do the basic plumbing before calling fork+exec. – wildplasser Nov 01 '21 at 12:48
  • 1
    Does this answer your question? [Linux 3.0: Executing child process with piped stdin/stdout](https://stackoverflow.com/questions/9405985/linux-3-0-executing-child-process-with-piped-stdin-stdout) – Chris Turner Nov 01 '21 at 12:48
  • If you don't need to send information to the child process other than via command-line arguments, then you can use `popen()` with `"r"` as the mode argument. Otherwise (if you need to send input to the child and read the response back), you will need to use code similar to what's suggested in [Linux: Executing child process with piped stdin/stdout](https://stackoverflow.com/q/9405985/15168), as suggested by @ChrisTurner. – Jonathan Leffler Nov 01 '21 at 14:39

0 Answers0