G
G
greenTransistor2016-12-13 05:00:09
linux
greenTransistor, 2016-12-13 05:00:09

How to run a program in a separate process in linux in C ++, get its PID and transfer the contents of the file to the stdin of the process?

The someProgram program is only available in binary form.
I tried
popen("cat ./someFile | ./someProgram &")
but instead of PID it gives the result of someProgram.
The PID is needed to kill someProgram if it takes too long to run.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CityCat4, 2016-12-13
@CityCat4

fork(), system(), getpid()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question