qprocess

How do I embed a binary executable (to be executed at runtime) in a Qt program?

浪子不回头ぞ 提交于 2019-11-26 17:07:34
问题 I'm writing a cross-platform C++ program using Qt and I want to package/embed a number of binary executables within the program. The program should be able to execute these binaries at runtime. I figured, I would need QResource and QProcess using start() and the ":/..." notation, but I don't seem to get the process running. Is there anything I am missing? Should it work like this? Does the binary need to be set as executable? Background: I am writing a tool which uses Git and I don't want to

How to get STDOUT from a QProcess?

喜欢而已 提交于 2019-11-26 14:02:48
问题 I thought I was going to get the output from a QProcess using the following code: // Start the process process.start(tr("php-cgi www/test.php"),QIODevice::ReadWrite); // Wait for it to start if(!process.waitForStarted()) return 0; // Continue reading the data until EOF reached QByteArray data; while(process.waitForReadyRead()) data.append(process.readAll()); // Output the data qDebug(data.data()); qDebug("Done!"); What I am expecting is to see the output from the program printed to the debug