Hi all!
I have the following code and can't figure out why I can't get the
QProcess output:
#include <QApplication>
#include <QProcess>
#include <QDebug>
int main(int argc, char **argv)
{
proc.
start("c:\\windows\\system32\\cmd.exe",
QIODevice::ReadWrite);
if (proc.waitForStarted() == false) {
qDebug() << "Error starting cmd.exe process";
qDebug() << proc.errorString();
return (-1);
}
// Show process output
qDebug() << proc.readAllStandardOutput();
proc.write("dir");
qDebug() << proc.readAllStandardOutput();
proc.close();
return 0;
}
#include <QApplication>
#include <QProcess>
#include <QDebug>
int main(int argc, char **argv)
{
QApplication application(argc, argv);
QProcess proc;
proc.start("c:\\windows\\system32\\cmd.exe", QIODevice::ReadWrite);
if (proc.waitForStarted() == false) {
qDebug() << "Error starting cmd.exe process";
qDebug() << proc.errorString();
return (-1);
}
// Show process output
qDebug() << proc.readAllStandardOutput();
proc.write("dir");
qDebug() << proc.readAllStandardOutput();
proc.close();
return 0;
}
To copy to clipboard, switch view to plain text mode
Any ideas?
Thanks!
Bookmarks