Unsolved How to start other .exe and return value ?
-
How to start other .exe and return value ?
Is it possible? -
-
@jsulm
Yes I know how to run another program, but how do I get value from it?
Maybe you give me the right direction -
Let's assume that we are going to perform the operation that can be accomplished or not. I want to understand that.
For small instance, I send a number to another exe and give it back if this number is less than 100. -
if you want to keep it simple:
this Signal and this function most likly.
alternatively, QSharedMemory, TCP/UDP ...
-
@J.Hilk
If my process is run .exe program that has a form we can do emit true or false or QVector ... QList...?
I can not understand how I could do that. -
@Taz742 Please read documentation, everything is there.
See http://doc.qt.io/qt-5/qiodevice.html#readyRead, http://doc.qt.io/qt-5/qiodevice.html#write-2, http://doc.qt.io/qt-5/qprocess.html#readAllStandardOutput
There is even an example showing how to do it:QProcess gzip; gzip.start("gzip", QStringList() << "-c"); if (!gzip.waitForStarted()) return false; gzip.write("Qt rocks!"); gzip.closeWriteChannel(); if (!gzip.waitForFinished()) return false; QByteArray result = gzip.readAll();
-
@Taz742 said in How to start other .exe and return value ?:
If my process is run .exe program that has a form we can do emit true or false or QVector ... QList...?
I can not understand how I could do that.You either use stdout/stdin like shown in my post above. Or you use some kind of IPC (Inter Process Communication). For example shared memory, DBus, ...
See http://doc.qt.io/qt-5/qtcore-ipc-sharedmemory-example.html for shared memory. -
I think the main question here is: how does your external application returns the data?
- does it exit with a different code for each possible result (it would be unsual but I'm not ruling it out)?
- does it print to standard output (the console) the answer? if so in what format?
- does it communicate in any other way (shared memory,DBus,TCP,Local Socket, HTTP, FTP, etc)?