I am writing on linux. Running bash commands like this:
system("команда"); Everything is good, but how do I get an answer? That is, the result of the command that is displayed in the console.
If you write with Qt, then it makes sense to use its functionality - QProcess
const int NO_TIMEOUT = -1; QProcess proc; proc.start("/bin/bash", QStringList() << "echo \"Hello World\""); proc.waitForFinished(NO_TIMEOUT); QString proc_stdout = proc.readAllStandardOutput(); QString proc_stderr = proc.readAllStandardError(); Source: https://ru.stackoverflow.com/questions/548796/
All Articles