hello,everybody.
I use Qprocess to connect my c program ,but the signal readyreadstandardoutput can not connect to my slot function?
why?I channge the signal to readyreadstandardError,is works,why?
Printable View
hello,everybody.
I use Qprocess to connect my c program ,but the signal readyreadstandardoutput can not connect to my slot function?
why?I channge the signal to readyreadstandardError,is works,why?
Hi, does your connect() call fail, or do you just get no data with readyReadStandardOutput?
In the second case, your c program probably writes to stderr, not to stdout.
Ginsengelf
because QProcess have two seperate channels to read normal output and error
if u want a single output useQuote:
It also emits readyReadStandardOutput() when new standard output data is available, and when new standard error data is available, readyReadStandardError() is emitted
setProcessChannelMode(QProcess::MergedChannels);
the following is some of my src code.
connect(&process,SIGNAL(readyReadStandardOutput()) ,this,SLOT(updaterev_line()));
。。。。。
process.setProcessChannelMode(QProcess::SeparateCh annels);
process.setReadChannel(QProcess::StandardOutput);
it does not work too!(the signal can not connect the solt func!)
no need to set this one .. it is default ...Quote:
process.setProcessChannelMode(QProcess::SeparateCh annels)
process.setReadChannel(QProcess::StandardOutput);
look u will receive readyReadStandardOutput() only when your external application that u are starting using QProcess should have stdOutput() .. if it is giving stdErr() then u cant receive readyReadStandardOutput() ..
only way to receive stdErr() in readyReadStandardOutput() .. merge the two channels ..
Quote:
QProcess merges the output of the running process into the standard output channel (stdout). The standard error channel (stderr) will not receive any data. The standard output and standard error data of the running process are interleaved.