[Qt-interest] newbie:facing issues with readallstdoutput and QProcess

john doe thebiggestbangtheory at gmail.com
Mon May 4 02:43:59 CEST 2009


Hello all,
            Thanks to all the awesome members who've helped out :-). My
application is finally working..yay! albeit not quite fully functional.

I am using QT 4.4.3, Ubuntu 8.10, and Qdevelop. I am trying to run an
external program from the command line. I am using a QProcess to do this and
want to read the output using readAllStandardOutput. I am using a large
QByte array to read in the output. Everything works fine if I try to run
something like echo hello. However, something simple like python --version
produces no output!!!

I am using the follwoing code
[code]

//This function allows for the user to

//read std output

void DialogImpl::readstdoutput()

{

QString output;

QByteArray ba;

ba.resize(2000);

//read the output

ba=myProcess->readAllStandardOutput();

textEdit_output->append(ba);

}
[/code]
and
[code]

//This function allows a file to

//be uploaded

void DialogImpl::Uploadfile()

{

if(radioButton_justgeneratefile->isChecked()==True)

{

 //set focus to output tab

myguitab->setCurrentIndex(3);

//clear the output area and write msgs

textEdit_output->clear();

textEdit_output->insertPlainText("\t***woohoo***");

textEdit_output->append("\t***woohoo again***");

textEdit_output->append("\t*********************************");

//just run external program

program="echo";

arguments << " hello ";

myProcess->start(program, arguments);

}

else

{

//do something else..

}

}
[/code]

If I use program=python; and arguments << "version" or "-version" or
"--version" no stdoutput or stderror is read back!
Can someone please help ?

Thanks in advance,
-A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090503/174262b1/attachment.html 


More information about the Qt-interest-old mailing list