I've been trying to launch and close an external program at certain point during my code, and was relying on system()
calls to accomplish that. However, here it was suggested that I use execlp
and a separate std::thread
entirely, in order to suppress console outputs.
The problem is, both of these solutions imply waiting for the program to close, which I want to avoid, as I need to communicate with that program (right now through UNIX sockets). Is there any way to use either execlp
or std::thread
to lauch a program in background, as I do with system([program]&)
?