[Interest] Qt and bash scripts
Thiago Macieira
thiago.macieira at intel.com
Sun Jul 1 14:27:27 CEST 2012
On domingo, 1 de julho de 2012 22.12.50, Phil wrote:
> {
> QProcess myProcess;
> QString str;
>
> myProcess.start( "ls" );
>
> if (!myProcess.waitForFinished())
> qDebug() << "Make failed:" << myProcess.errorString();
> else
> {
> qDebug() << "Make output:" << myProcess.readAll();
>
> str = myProcess.readAll();
> qDebug() << "string = " << str;
>
> QByteArray array = myProcess.readAllStandardOutput();
>
> qDebug() << "array size = " << array.size();
>
> }
> }
>
> The string = "" and the array size = 0;
You're reading stdout three times: by default, read and readAll are connected
to stdout. Did you mean to readAllStandardError() in the second check?
I have to ask: are there any files to be listed in the current directory of the
application?
What showed up in the "Make output" line?
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
Intel Sweden AB - Registration Number: 556189-6027
Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120701/9018433a/attachment.sig>
More information about the Interest
mailing list