Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
4.8.5, 5.2.1
-
None
Description
Suppose you're reading from standard input or from a network stream using QTextStream. You read a numeric value, and then you read a single character.
- The single character read will be the newline terminating the previous numeric value. This is seemingly correct, although different from iostream's behavior - perhaps it should be better documented?
- What's incorrect is that operator>>(char&) and operator>>(QChar&) waits for a non-whitespace character in spite of there already being a newline in the buffer.
QTextStream cin(stdin); int a; char b; cin >> a; cin >> b; // blocks for non-whitespace input in spite of there being whitespace input available #ifdef Q_OS_UNIX Q_ASSERT(b == '\n') #endif