Is there a cross-platform command line library for C ++?

To run a command line using C ++, I always use the system command. However, I think this method is too error prone, as I can parse char* as an argument without any other information. So, I'm looking for a cross-platform library that works well with the command line? Does anyone know someone?

Thanks,
Chan

+4
source share
2 answers

Take a look at Boost.Process . It is still under development and is not yet part of the official Boost, but it looks promising.

+4
source

Qt's QProcess does this in a cross-platform way.

http://doc.qt.nokia.com/4.6/qprocess.html

The above documentation uses an example:

 // some parent object QObject * parent; QString program = "./path/to/Qt/examples/widgets/analogclock"; QStringList arguments; arguments << "-style" << "motif"; QProcess *myProcess = new QProcess(parent); myProcess->start(program, arguments); 
+2
source

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


All Articles