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. How Can I Pass an argument value to an external program In Qt
Forum Updated to NodeBB v4.3 + New Features

How Can I Pass an argument value to an external program In Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 812 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    seokwon
    wrote on 6 Mar 2018, 00:23 last edited by
    #1

    Hello, I have a question.
    I use this code in qt
    QProcess *process = new Qprocess;
    QString filePath = QDir::homePatg()+"someThing.exe";
    process->start(filePath);

    So, How can i Pass an argument value to an external program?

    I am waiting your command. Please help me.

    J 1 Reply Last reply 6 Mar 2018, 06:11
    0
    • P Offline
      P Offline
      Paul Colby
      wrote on 6 Mar 2018, 03:32 last edited by
      #2

      Hi @seokwon,

      How can i Pass an argument value to an external program?

      You can pass command line arguments as the second parameter to the QProcess::start() method.

      For example:

      QStringList args;
      args << "arg1" << "arg2";
      process->start(filePath, arg);
      

      Cheers.

      S 1 Reply Last reply 6 Mar 2018, 07:58
      4
      • S seokwon
        6 Mar 2018, 00:23

        Hello, I have a question.
        I use this code in qt
        QProcess *process = new Qprocess;
        QString filePath = QDir::homePatg()+"someThing.exe";
        process->start(filePath);

        So, How can i Pass an argument value to an external program?

        I am waiting your command. Please help me.

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 6 Mar 2018, 06:11 last edited by
        #3

        @seokwon QProcess documentation (http://doc.qt.io/qt-5/qprocess.html) shows how to do this. Did you read it?

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

        1 Reply Last reply
        3
        • P Paul Colby
          6 Mar 2018, 03:32

          Hi @seokwon,

          How can i Pass an argument value to an external program?

          You can pass command line arguments as the second parameter to the QProcess::start() method.

          For example:

          QStringList args;
          args << "arg1" << "arg2";
          process->start(filePath, arg);
          

          Cheers.

          S Offline
          S Offline
          seokwon
          wrote on 6 Mar 2018, 07:58 last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0

          1/4

          6 Mar 2018, 00:23

          • Login

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