PDA

View Full Version : New to QT Programming



Charlie
22nd August 2007, 19:25
Right im new to QT programming so I thought for my first app I would try to write a wireless driver manager which will use ndiswrapper on the command line using system(); but the following piece of code which I am using to show all the drivers already installed just comes up as a square in the textBrowser



QString output;
output = system("ndiswrapper -l");
textBrowser->setText(output);

marcel
22nd August 2007, 19:36
And what is "system"?
Why don't use QProcess?

Regards

Charlie
22nd August 2007, 19:41
system() simply just allows you to execute shell scripts but I can then parse the output. How would I use QProcess??

marcel
22nd August 2007, 19:49
Read the docs for QProcess
You should call:


process.start("ndiswrapper -l");
process.waitForFinished();
QByteArray outArray = processl.readAllStandardOutput();
QString str = outArray.constData();


Something like that.
This is just a draft so you might wanna improve that a bit( extra checks for return values, etc).

Regards

Charlie
22nd August 2007, 19:50
Thanks :) Thats great help.