Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Why Qprocess is not returning output on qt but on command prompt it is working properly?
Himanshu charde last edited by
process.start("curl -Is https://docs.google.com/forms/d/1DX3werwwT29AHMwjpoqEJjAtWcuHwsS7ruHG2_IJPtbqsaFw/edit");
- Your start call is wrong: pass the parameters to curl as a QStringList (read documentation)
- You're waiting for process to finish - your app will be blocked until the process finishes
- How do you read the output of the process in Qt?
JonB last edited by JonB
In fact in the case you show I think your
process.start("literal string")will work OK, but only because it doesn't happen to have any special characters which need quoting. But @jsulm suggestion to use the separated string list arguments is more robust if that changes.
The vital thing is that as @jsulm says you are not attempting to read any output from the process back into your Qt app. You'll want https://doc.qt.io/qt-5/qprocess.html#readAllStandardOutput and possibly https://doc.qt.io/qt-5/qprocess.html#readyReadStandardOutput.
And while you are at it, always do the same for https://doc.qt.io/qt-5/qprocess.html#readAllStandardError. And the https://doc.qt.io/qt-5/qprocess.html#errorOccurred signal. People don't bother and then wonder what's happening when an error is reported....