Questions tagged [qprocess]

The QProcess class, part of the Qt framework, provides a way to start external programs and to communicate with them.

The QProcess class is used to start external programs and to communicate with them.

To start a process, pass the name and command line arguments of the program you want to run as arguments to start(). Arguments are supplied as individual strings in a QStringList.

Alternatively, you can set the program to run with setProgram() and setArguments(), and then call start() or open().

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

675 questions
0
votes
1 answer

How to fetch output when calling R using Qprocess or system

I would like to execute a R script simply as R --file=x.R It runs well on the command line. However when I try the system call in C++ by QProcess::execute("R --file=x.R"); or system("R --file=x.R"); the program R runs and quits but I can't see…
SYK
  • 644
  • 6
  • 17
0
votes
1 answer

Running another Qt based app with QProcess (runs non Qt based programs just fine)

I use QProcess to run other non Qt based programs and they all work fine. App1 tries to call App2 which is located in App1.app/Contents/deps. The other programs it calls are also located in that directory. If I run App2 from finder or QtCreator it…
ATSOTECK
  • 79
  • 1
  • 5
0
votes
1 answer

Command Line closing despite using QProcess::startDetached()

I'm trying to open a server via batch file in cmd.exe in my Qt application. Despite I'm using QProcess::startDetached() to start the command line it closes immediately after start. The server is starting, but instead of "serving" the process is…
El_Mewo
  • 99
  • 8
0
votes
0 answers

QProcessEnvironment a value with spaces and quotes

I am setting the environment for a program I will be launching using QProcess. One of the environment variables I need to set MAY contain spaces, slashes, and quotes. What is the right way to handle this? I've tried escaping quotes, and adding a…
TSG
  • 4,242
  • 9
  • 61
  • 121
0
votes
1 answer

If setProcessEnvironment the QProcess will not run

I have a simple piece of code that runs an external script (see below). The code runs great. Now I want to set an environment variable before running the script. When I do, the waitForStarted method fails with error code 0 and errorString "Exec…
TSG
  • 4,242
  • 9
  • 61
  • 121
0
votes
1 answer

QProcess fails to execute a simple console program

I compiled a c++ source file from the Qt app I am creating. Now I want to run the exe file generated and also to redirect its input and output to txt files. But when I try to run it from QProcess, it fails to execute with exit code -2. This is how I…
Shubham
  • 935
  • 1
  • 7
  • 25
0
votes
1 answer

Unable to start g++ using QProcess

I want to compile a c++ file from Qt application by using QProcess. But it is not working, I don't see any .o or .exe file generated by the compiler. Here is what I am doing - QProcess *process = new QProcess(this); QString program =…
Shubham
  • 935
  • 1
  • 7
  • 25
0
votes
0 answers

Get output of Qprocess in a variable?

This question is similar to this one. The difference is that the solution specified there doesn't work always. Example 1 QProcess * process; process = new QProcess(); process->start("/usr/bin/env"); process->waitForFinished(-1); QString p_stdout =…
TheMeaningfulEngineer
  • 15,679
  • 27
  • 85
  • 143
0
votes
2 answers

Change PATH environment variable for cmd.exe with QProcessEnvironment

I want to start cmd.exe from a Qt app with a specific PATH set. I insert "Path" in QProcessEnvironment and set that environment to QProcess. Then I startDetached "cmd". On the command prompt, the path is the same as the from the calling app, not…
Woomla
  • 199
  • 1
  • 3
  • 12
0
votes
2 answers

How to insert a command line to GUI applications

I need to make a QT GUI application that will be able to run the command line batchs and commands. For example, ping, tcpdump, etc. ... I would imagine it like this: The standard graphical window with the QTableView, some checkboxes, etc. ... with…
exo
  • 373
  • 5
  • 22
0
votes
0 answers

Running WampServer using a QPushButton

i am trying to run wampserver using a QPushbutton : when i click on a QPushbutton i have a SLOT runnig void LoginFenetre::lancerWampServer(){ //QProcess::startDetached("\"G:/Games/3DM-dhredgoyear/Launcher.exe\""); QString wampPath =…
0
votes
1 answer

GNU find from QProcess - Cannot use exec parameter

I'm running GNU find in a QProcess which works just fine. Nevertheless, when I try to combine it with grep, it does not execute at all. The QProcess is started with process->start(findpattern.replace("~",QDir::home().absolutePath()),…
user2707001
  • 1,543
  • 12
  • 13
0
votes
1 answer

how to use QProcess to wrap telenet.exe on Windows?

I'm trying to code a wrapper class using QProcess to drive the CLI applications (e.g. telnet.exe, ftp.exe) on Windows but so far with no luck. Do you know if this is even possible? Below is the code I used to try with telnet.exe on Windows 7. I was…
zhongzhu
  • 307
  • 2
  • 4
  • 14
0
votes
1 answer

Running and killing processes in QT C++ via button press

I am trying to write a GUI, that when a button is pressed, will either start or stop a process. Currently, my code won't even start the process, and I am stuck to why that is. The button clicks and the text changes, but the process doesn't execute…
0
votes
1 answer

QProcess Reads each letter in string as separate

I'm trying to use a QProcess to run a mkdir command (I'm using linux). The process would create a folder on the user's Desktop called 'output'. The code looks like this: def mkOutput(): # get the user's environmental variables env =…
CogDissonance
  • 87
  • 1
  • 4