On Sunday 01 July 2012 14:12:50 Phil wrote:
> On 01/07/12 21:38, Thiago Macieira wrote:
> >> I had also tried start() but the output still goes to the console. Is it
> >> possible to have the directory list inserted into a string or string
> >> list?
> > 
> > Please show us the code you used when you used start().
> 
> {
>      QProcess myProcess;
>      QString str;
> 
>      myProcess.start( "ls" );
> 
>      if (!myProcess.waitForFinished())
It should work, but it's blocking (which is not nice)... you should make use 
of QProcess's asnychronous operation.

>           qDebug() << "Make failed:" << myProcess.errorString();
>       else
>      {
>           qDebug() << "Make output:" << myProcess.readAll();
> 
>           str = myProcess.readAll();
Use QProcess::readAllStandardOutput() to read from the process's stdout 
channel:
http://qt-project.org/doc/qt-4.8/qprocess.html#readAllStandardOutput

Use QProcess::readAllStandardError() to read from stderr:
http://qt-project.org/doc/qt-4.8/qprocess.html#readAllStandardError

HTH, René
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to