Poco and ACE have process classes that do what you want. See Foundation-> Processes-> Process in Poco; Process.h / Process.cpp for Ace. I would not be surprised if QT has something similar.
As for how to do this, basically you transfer OS dependencies and bury details. Poco and Ace offer contrasting general methods. Poco has a tendency to handle things by writing implementation objects (xxx_impl) for each platform, and the one suitable for it can be obtained depending on the OS. It seems ACE #ifdef code, sometimes to the point of madness, although, to be honest, I looked at this code for a long time.
source
share