Important: Please read the Qt Code of Conduct -

Try To run .exe using Qt QProcess

  • I try to compile a .exe file that takes arguments using QProcess but I don't get any output

      QString program = QDir::currentPath() + "/pdftotext.exe"; // programe path
      QStringList arguments;
      arguments << "-f 1 a.pdf out.txt"; // argument that take
      //arguments << "-f 1 \"D:/a.pdf\" \"D:/out.txt\"; // i try this first 
      QProcess *myProcess = new QProcess(this);
      myProcess->start(program, arguments);
      qDebug() << myProcess->errorString();

    the .exe file run from cmd as

    C:\> pdftotext.exe -f 1 "D:\a.pdf" "D:\out.txt"

    how can i solve this

  • Lifetime Qt Champion


    arguments is a QStringList, each element of your arguments must be added one by one to that string list.

  • Thank You @SGaist solved

    arguments << "-f" << "1" << "D:/amr.pdf" << "D:/out.txt";

Log in to reply