I'm trying to run a external c++ file using QProcess in my app. this is the c++ source:
I use a QTextEdit to show and get named Terminal this is what happens when the return key is pressed on my textedit:
QString text = Terminal->toPlainText();
and this is what happens when there is something to read from process:
when I run the app, "enter s" is shown in the textedit. when I enter anything and press return the text nothing happenes (the string doesn't get shown). what am I doing wrong?
You should rather use readAllStandardOutput.
On a side note, there's not need for these conversion from and to std::string. You can get a QByteArray from QString directly using either toUtf8 or toLatin1.
Hi Thank you @SGaist
I changed the code to show the standard output and the standard error.
The main problem was with the end lines. apparently std::cin recognizes \n as the end of input in linux.
apparently std::cin recognizes \n as the end of input in linux.
Same as windows, same as OSX. In text mode
\nis end of line, that is where
cin >>will stop reading.
Thank you kshegunov & SGaist. the problem is solved