[Interest] Qt and bash scripts

Phil phil_lor at bigpond.com
Mon Jul 2 07:33:03 CEST 2012


On 02/07/12 14:41, Mandeep Sandhu wrote:
>
> As Thiago mentioned, why aren't you using QDir/QFileInfo for this
> requirement? You don't need to run 'ls' to get a dir's contents. Or
> did you use ls just to illustrate your problem?

Yes, it's just an example.

> Also, in your sample code, you're calling myProcess.readAll(), twice!
> The first call to readAll() would empty your process' output buffer
> and hence your second call is not showing any data. Just call
> myProcess.readAllStandardOutput() once and store the contents in your
> bytearray.
>

The multiple read calls were just for debugging purposes. I didn't 
realise that the output buffer would be emptied after the first read call.

Anyway, that was the answer, thank you Mandeep.

-- 
Regards,
Phil



More information about the Interest mailing list