Redirect QProcess::execute() output to /dev/null
-
wrote on 23 Sept 2019, 11:45 last edited by
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
wrote on 23 Sept 2019, 12:45 last edited by@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()
wrote on 24 Sept 2019, 07:05 last edited by@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
wrote on 24 Sept 2019, 07:05 last edited by@Pablo-J-Rogina
Thanks for the link Pablo, Will certainly take a look at it .
3/5