PDA

View Full Version : how to make system calls to be displayed in QLineEdit



wagmare
8th November 2008, 07:43
hi friends/experts,
I have succeed in calling a system call inside my application
ex=> system("htmlview 192.168.1.4") ;

but is it possible to display the result of the command call to be display in QLineEdit
ex: I need to display ifconfig call to be display in my lineEdit

please help me to solve the problem ....
thanks

caduel
8th November 2008, 08:44
using system, not really.
possibilities
* shell redirection: system("your command > outputfile")
then read the file, unlink it, and display the contents
// not quite so portable as QProcess
// you need to generate a (free) temp. filename
// you need write access to some place
* use QProcess (this is what i would suggest)

HTH

wagmare
10th November 2008, 05:08
thanks ya,
i made it so fine using QProcess


my code : QString program = "/sbin/ifconfig";
QStringList arguments;
arguments <<"eth0";

proc = new QProcess(this);
connect(proc, SIGNAL(readyReadStandardOutput()), this, SLOT(readFromStdout()));
proc->start(program, arguments);
}
void Panel2::readFromStdout()
{
ui->resultTextEdit->setPlainText(proc->readAllStandardOutput() );
}


i made it.....