views:

413

answers:

3

...and of course obtaining the output in some way I can use it. I'd use it for an ls | grep, but it's good to know for any future issues.

Thanks in advance.

+1  A: 

Use QProcess.

e8johan
For some tasks, it might be easier (or more robust) to roll your own code - you mention ls | grep, potentially QDir with a filter or a QRegExp might do what you need. For the general case, though, QProcess is absolutely the best way to go.
James Turner
That's a great observation. I think I'll try that another time but the question in this case was also somewhat oriented for the general case for future uses.Thanks anyway!
StJimmy
A: 

What about using popen?

Hope this helps, Best regards, Tom.

tommieb75
Not very much Qt though...
e8johan
e8johan: True...I understand you want to use QT API but thought I'd give this answer. :)
tommieb75
+5  A: 
QProcess p;
p.start( /* whatever your command is, see the doc for param types */ );
p.waitForFinished(-1);

QString p_stdout = p.readAllStandardOutput();
QString p_stderr = p.readAllStandardError();
Fred