QProcess fails to execute external executable

前端 未结 1 1987
萌比男神i
萌比男神i 2021-01-19 00:11

I am struggling to find a solution to my problem, but I simply have no clue how to solve it.

I am creating an user-interface for some programs I made (so you can thr

1条回答
  •  滥情空心
    2021-01-19 00:21

    QProcess has 3 functions for starting external processes, such as: -

    • start
    • execute
    • startDetached

    The latter two, execute and startDetached are static, so don't need an instance of QProcess to call them.

    If you use start, you should at least be calling waitForStarted() to let the process setup properly. The execute() function will wait for the process to finish, so calling waitForStarted is not required.

    As you've only posted a small amount of code, we can't see exactly what you're trying to do afterwards. Is that code in a function that ends, or are you trying to retrieve the output of the process? If so, you definitely should be calling waitForStarted if using start().

    If you only want to run the process without waiting for it to finish and your program is not bothered about interacting with the process, then use startDetached: -

    QProcess::startDetached("C:\\DIRTOTHEEXE\\HELLO.exe");
    

    0 讨论(0)
提交回复
热议问题