View Full Version : Why doesn't QTextStream wait for input?

19th December 2011, 23:12
In this little program why doesn't in wait for input?

#include <QtCore>

int main(int argc, char *argv[])
QTextStream in(stdin, QIODevice::ReadOnly);
QTextStream out(stdout, QIODevice::WriteOnly);

QString str;
out << "Enter something: ";
in << str;
out << "hello " << str << "\n";

return 0;
When i execute this i get

Enter something: hello
Press <RETURN> to close this window...
So what is going on that i don't understand?

20th December 2011, 05:08
You are using operator<<() when you should be using operator>>() at line 10