call external executable file in Mac OS from QT
-
wrote on 31 Jul 2018, 09:40 last edited by zhaobofu
I ‘m trying to call an external executable file in Mac OS using DesktopServices , the executable name is
ABC.x, I can run the executable from Mac OS command line with ./ ABC.xBut cannot find a right way to call the executable from QT, I tried something as following, but it is not working
QProcess *process =new QProcess(this);
QString program="/Users/itadmin/Documents/ABC/ABC.x";
process->start(program,QStringList()<<"");the executable not launching. (No response) Please help.
-
I ‘m trying to call an external executable file in Mac OS using DesktopServices , the executable name is
ABC.x, I can run the executable from Mac OS command line with ./ ABC.xBut cannot find a right way to call the executable from QT, I tried something as following, but it is not working
QProcess *process =new QProcess(this);
QString program="/Users/itadmin/Documents/ABC/ABC.x";
process->start(program,QStringList()<<"");the executable not launching. (No response) Please help.
-
I ‘m trying to call an external executable file in Mac OS using DesktopServices , the executable name is
ABC.x, I can run the executable from Mac OS command line with ./ ABC.xBut cannot find a right way to call the executable from QT, I tried something as following, but it is not working
QProcess *process =new QProcess(this);
QString program="/Users/itadmin/Documents/ABC/ABC.x";
process->start(program,QStringList()<<"");the executable not launching. (No response) Please help.
@zhaobofu Why are you passing empty string as parameter?
Did you check http://doc.qt.io/qt-5/qprocess.html#errorOccurred ? -
wrote on 3 Aug 2018, 06:26 last edited by
QProcess more suitable for this. What error your getting when u QProcess?
-
QProcess more suitable for this. What error your getting when u QProcess?
wrote on 6 Aug 2018, 04:28 last edited by@Chandras002 yes I tried, but there was no error at all!
-
@zhaobofu
In principle you have the right code, provided the path is correct.You will need to look through
QProcess
docs for code which lets you see errors, likeerror()
,readAllStandardError()
,errorOccurred()
, and similar.wrote on 6 Aug 2018, 04:48 last edited by@JonB thanks I solved the problem by using QT to call a cs.command file, and cs.command calls the executable file.
QString program="Users/itadmin/Documents/det1/cs.command";
QDesktopServices::openUrl(QUrl("file:///"+program, QUrl::TolerantMode));
5/6