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

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

    JonBJ jsulmJ 2 Replies Last reply
    0
    • Z 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.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.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on 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
      3
      • Z 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.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.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on 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
        • Chandras002C Offline
          Chandras002C Offline
          Chandras002
          wrote on last edited by
          #4

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

          Z 1 Reply Last reply
          0
          • Chandras002C Chandras002

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

            Z Offline
            Z Offline
            zhaobofu
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0
            • JonBJ JonB

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

              • Login

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