Is it possible to send answer to cmd by QT?
-
@JonB I added code consoleApp.exe ( look at my second post which is started "I have 2 apps:" ). Of course I add this code in this post too:
#include <QCoreApplication> #include "iostream" using namespace std; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); string answer; cout<<"Do you prefer forest or sea?"; cin>>answer; if(answer == "forest") { cout<<"You prefer forest!"; } else if(answer == "sea") { cout<<"You prefer sea!"; } else { cout<<"This answer is bad!"; } exit(0); return a.exec(); }
I would like to start consoleApp.exe from my mainApp.exe, get the question "Do you prefer forest or sea?" from consoleApp.exe, send the answer "sea" to consoleApp.exe from mainApp.exe, get the output "You prefer sea!" from consoleApp.exe.
-
@JonB I added code consoleApp.exe ( look at my second post which is started "I have 2 apps:" ). Of course I add this code in this post too:
#include <QCoreApplication> #include "iostream" using namespace std; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); string answer; cout<<"Do you prefer forest or sea?"; cin>>answer; if(answer == "forest") { cout<<"You prefer forest!"; } else if(answer == "sea") { cout<<"You prefer sea!"; } else { cout<<"This answer is bad!"; } exit(0); return a.exec(); }
I would like to start consoleApp.exe from my mainApp.exe, get the question "Do you prefer forest or sea?" from consoleApp.exe, send the answer "sea" to consoleApp.exe from mainApp.exe, get the output "You prefer sea!" from consoleApp.exe.
@TomNow99
Your reply has crossed with my seeing the earlier code, which I think you have just added? You see that we need to see that in order to have a clue what is going on! Please read the EDIT section of my post above, I think that's all your problem is.