Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. call external executable file in Mac OS from QT
QtWS25 Last Chance

call external executable file in Mac OS from QT

Scheduled Pinned Locked Moved Solved General and Desktop
mac-osexternal executcall
6 Posts 4 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zhaobofu
    wrote on 31 Jul 2018, 09:40 last edited by zhaobofu
    #1

    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.x

    But 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.

    J J 2 Replies Last reply 31 Jul 2018, 10:19
    0
    • Z zhaobofu
      31 Jul 2018, 09:40

      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.x

      But 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.

      J Offline
      J Offline
      JonB
      wrote on 31 Jul 2018, 10:19 last edited by
      #2

      @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, like error(), readAllStandardError(), errorOccurred(), and similar.

      Z 1 Reply Last reply 6 Aug 2018, 04:48
      3
      • Z zhaobofu
        31 Jul 2018, 09:40

        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.x

        But 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.

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 31 Jul 2018, 10:28 last edited by
        #3

        @zhaobofu Why are you passing empty string as parameter?
        Did you check http://doc.qt.io/qt-5/qprocess.html#errorOccurred ?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        3
        • C Offline
          C Offline
          Chandras002
          wrote on 3 Aug 2018, 06:26 last edited by
          #4

          QProcess more suitable for this. What error your getting when u QProcess?

          Z 1 Reply Last reply 6 Aug 2018, 04:28
          0
          • C Chandras002
            3 Aug 2018, 06:26

            QProcess more suitable for this. What error your getting when u QProcess?

            Z Offline
            Z Offline
            zhaobofu
            wrote on 6 Aug 2018, 04:28 last edited by
            #5

            @Chandras002 yes I tried, but there was no error at all!

            1 Reply Last reply
            0
            • J JonB
              31 Jul 2018, 10:19

              @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, like error(), readAllStandardError(), errorOccurred(), and similar.

              Z Offline
              Z Offline
              zhaobofu
              wrote on 6 Aug 2018, 04:48 last edited by
              #6

              @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));

              1 Reply Last reply
              0

              2/6

              31 Jul 2018, 10:19

              4 unread
              • Login

              • Login or register to search.
              2 out of 6
              • First post
                2/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved