Dear Santosh,
Thanks again.
The below code makes a QString that is empty as this does not print anything on the screen
arguments << "-b" << "-t" << "input.txt";
myProcess->start(program, arguments);
if(myProcess->waitForStarted(5000))
{
QByteArray out_data
= myProcess
->readAllStandardOutput
();
qDebug() << out_string.toStdString().c_str();
cout << "results: " << out_string.toLocal8Bit().constData() << "\n";
}
else
{
qDebug() << "myProcess did not start in time";
}
QObject *parent;
QString program = "./ent";
QStringList arguments;
arguments << "-b" << "-t" << "input.txt";
QProcess *myProcess = new QProcess(parent);
myProcess->start(program, arguments);
if(myProcess->waitForStarted(5000))
{
QByteArray out_data = myProcess->readAllStandardOutput();
QString out_string(out_data);
qDebug() << out_string.toStdString().c_str();
cout << "results: " << out_string.toLocal8Bit().constData() << "\n";
}
else
{
qDebug() << "myProcess did not start in time";
}
To copy to clipboard, switch view to plain text mode
I know that the other program works because this gives me the correct answer:
system("./ent -b -t input.txt");
system("./ent -b -t input.txt");
To copy to clipboard, switch view to plain text mode
Do you advise against using the latter version?
Bookmarks