vendredi 20 janvier 2023

create a child process in C++ (linux) [closed]

I'm very much a newbie to this kind of thing so please do try to explain any new terms that you use.

I have a main program. As part of it, what I would like to do is to run a shell program (in this case Stockfish15) in a separate shell. I then want to pass some commands to it in the code, and then read the output and use it in the rest of my main program.

I understand that to do this I need to create a child process and then redirect the input and output stream of it. But I don't know how to do that.

So, my question is, how do I create a child process and redirect its input/output on a ubuntu system (in C++11)?

I have found this resource. However, I didn't find it very helpful because a) it seems to be giving Windows specific instructions while I am on a Ubuntu system and b) it uses a bunch of functions in the code without explaining any of them.

Aucun commentaire:

Enregistrer un commentaire