I am trying to read the output of a linux command using QProcess but its not given the correct output.
process.start("iwconfig 2>&1 | grep ESSID");
process.waitForFinished();
usleep(1000);
QString output
(process.
readAllStandardOutput());
qDebug()<<output;
QString err
(process.
readAllStandardError());
qDebug()<<err;
QProcess process;
process.start("iwconfig 2>&1 | grep ESSID");
process.waitForFinished();
usleep(1000);
QString output(process.readAllStandardOutput());
qDebug()<<output;
QString err(process.readAllStandardError());
qDebug()<<err;
To copy to clipboard, switch view to plain text mode
In this code the qDebug()<<output; prints "" and
qDebug()<<err; prints "iwconfig: unknown command "|"
"
When I run this same command "iwconfig 2>&1 | grep ESSID" in terminal window its shown
wlan0 IEEE 802.11bgn ESSID:"Arun Kumar" Nickname:"<WIFI@REALTEK>"
Why my program printing "iwconfig: unknown command "|"", what is the error in my code and how I can correct this in my code?
Bookmarks