Is there a cross-platform exec in Boost?

I want to execute a subprocess in C ++. I need it to work on Windows and Linux. Is there such a feature in Boost? What is the standard way to do this?

+3
source share
4 answers

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.

+2
source

There is an unapproved Boost.Process library. I have never tried, but it can do the job for you.

I have successfully used the Poco API process.

+3
source

? system(), . , popen ( MS _popen). , - , .

+1

ANSI C89 system() . , , , . , , , .

0

Source: https://habr.com/ru/post/1720237/


All Articles