popen equivalent in c++

2019-01-09 14:30发布

问题:

Is their any C popen() equivalent in C++ ?

回答1:

You can use the "not yet official" boost.process if you want an object-oriented approach for managing the subprocess.

Or you can just use popen itself, if you don't mind the C-ness of it all.



回答2:

There is no C++ equivalent in any Standard, however C++ wrappers around this function (and other POSIX process function) can be found in various UI Toolkit (e.g QT, glibmm) and in the pstreams library.



回答3:

C++ is a superset of C. popen is available to C++ code as well.



标签: c++ posix popen