From 37d8c8030e67629e621a77e9022d59cb69c73f3e Mon Sep 17 00:00:00 2001 From: Niklas Goby Date: Thu, 10 Mar 2011 18:18:37 +0100 Subject: added a method for reading the out put of a script. --- src/sysInfo.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/sysInfo.cpp') diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp index f5cd18d..7cf2124 100644 --- a/src/sysInfo.cpp +++ b/src/sysInfo.cpp @@ -82,9 +82,37 @@ QString sysInfo::getAllInfos(){ infos.insert("mac", getMACAddress()); infos.insert("ip", getIPAddress()); - QJson::Serializer serializer; + //QJson::Serializer serializer; QByteArray json = serializer.serialize(infos); if (debug) qDebug() << json; return json; } +// +QStringList sysInfo::getPrcOutP2() +{ + QString cmd = "echo test"; + QProcess *process = new QProcess(); + qDebug()<<"try to open: "<start(cmd, QIODevice::ReadOnly); + + if (!process->waitForStarted() ) + qDebug()<<"process couldn't get opened"; + + QStringList output; + process->waitForFinished(); + + QTextStream *txt_stream = new QTextStream(process); + + while(!txt_stream->atEnd() ) + { + qDebug()<<"read output: "; + QString tmp_str = txt_stream->readLine(); + output.append(tmp_str); + qDebug()<