QProcess process; process.start("ls", QStringList() << "-l" << "/tmp"); process.waitForFinished(); int exitCode = process.exitCode();
QProcess process; process.start("my_program"); while (!process.waitForFinished(1000)) { qDebug() << "Still running..."; } int exitCode = process.exitCode();This code starts the "my_program" executable and periodically checks if it has finished. Once it has, the exit code is retrieved. The QProcess class is part of the Qt Core module.