It is possible to run cmd's commands using C++ in QT app?

294 views Asked by At

I am making a QT mobile app (Sailfish Os, it's made with Linux) and I need to run some processes with commands which could be run only with command line/terminal. Can I do this using QT/C++ code or I am talking about something impossible? :)

1

There are 1 answers

2
Farshid616 On BEST ANSWER

Yes it's possible, you can run Linux commands in Qt app by using QProcess. This is a small example:

QProcess *system_command = new QProcess();
system_command->start("/bin/bash");
system_command->waitForFinished(500);
system_command->write("ls -a\n");