QProcess process; process.start("myProgram.exe"); // do something process.close();
QProcess process; process.start("myProgram.exe"); QEventLoop loop; QObject::connect(&process, SIGNAL(finished(int)), &loop, SLOT(quit())); loop.exec(); process.close();This code starts "myProgram.exe" and waits until it finishes before closing it. The QEventLoop is used to block the current thread until the process finishes. Package/Library: Qt (QtCore)