In this little program why doesn't in wait for input?
#include <QtCore>
int main(int argc, char *argv[])
{
out << "Enter something: ";
in << str;
out << "hello " << str << "\n";
return 0;
}
#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;
}
To copy to clipboard, switch view to plain text mode
When i execute this i get
Enter something: hello
Press <RETURN> to close this window...
Enter something: hello
Press <RETURN> to close this window...
To copy to clipboard, switch view to plain text mode
So what is going on that i don't understand?
Bookmarks