[SOLVED] How to write commands in gnome-terminal using QProcess??
-
I have coded the following lines. Only the gnome terminal is opening and the command i tried to write inside the terminal (for eg) "ls" is not working
@QProcess proc;
proc.start ("gnome-terminal");
proc.waitForStarted();
proc.write("ls\n");
proc.waitForBytesWritten();
proc.waitForFinished();@What am i supposed to do?
-
HI and welcome
Here is how one can run ping with parameters
Hope it can give hint.QProcess pingProcess; QString exec = "ping"; QStringList params; params << "-c" << "1" << IP; pingProcess.start(exec,params,QIODevice::ReadOnly); pingProcess.waitForFinished(-1); QString p_stdout = pingProcess.readAllStandardOutput(); QString p_stderr = pingProcess.readAllStandardError();