Redirect QProcess::execute() output to /dev/null
-
Hi all,
I am trying to run a command to set a date
QString currentDate = "date -s "tomorrow""
#if defined (linux) || defined(FreeBSD)
int isDateSet= QProcess::execute(currentDate);
#endifThis writes the output to console.However i wish to redirect the output to /dev/null.
In linux command line , I can provide as followsdate -s "tomorrow" > /dev/null
But how do I do the same with QProcess::execute()
Thanks in advance
-
Don't use the static QProcess::execute() function but a QProcess object and read the data from stdout after the finished signal with QProcess::readAllStandardOutput()
-
Hi all,
I am trying to run a command to set a date
QString currentDate = "date -s "tomorrow""
#if defined (linux) || defined(FreeBSD)
int isDateSet= QProcess::execute(currentDate);
#endifThis writes the output to console.However i wish to redirect the output to /dev/null.
In linux command line , I can provide as followsdate -s "tomorrow" > /dev/null
But how do I do the same with QProcess::execute()
Thanks in advance
@Madesh-R you may want to take a look at the documentation regarding communicating via channels
-
Don't use the static QProcess::execute() function but a QProcess object and read the data from stdout after the finished signal with QProcess::readAllStandardOutput()
@Christian-Ehrlicher
Thank you Christian. Will try the same -
@Madesh-R you may want to take a look at the documentation regarding communicating via channels