QProcess: start a compiled c program and output to textBrowser in Linux
-
@Naim , @mrjj
If you like trivia (you probably don't...), you can actually execute it without the execute bit set via the accepted answer to https://superuser.com/questions/341439/can-i-execute-a-linux-binary-without-the-execute-permission-bit-being-set :) -
@mrjj said in QProcess: start a compiled c program and output to textBrowser in Linux:
@JNBarchan
But does it set the bit ?
chmod a-x /tmp/lschmod a-x /tmp/ls
clears the executable bit ;) -
I may have find the problem here. My C program a.out runs indefinitely and textBrowser only shows the output once my program have finished executing. I've tried to run another C program that accepts command line input to loop how many times. Its output shows up in textBrowser after it has done looping.
-
@Naim Use http://doc.qt.io/qt-5/qprocess.html#readyReadStandardOutput and http://doc.qt.io/qt-5/qprocess.html#readyReadStandardError to get notifications each time the process writes something to stdout or stderr and read it using http://doc.qt.io/qt-5/qprocess.html#readAllStandardOutput and http://doc.qt.io/qt-5/qprocess.html#readAllStandardError. Do not call waitForFinished, just make sure your proc does not go out of scope (make it class member).