Jonathan Mcdougall wrote:[color=blue]
>
> Calling clear() on the stream resets its state to good. For a reason I
> cannot explain (perhaps someone else could enlighten us),[/color]
Once you know, it is actually very simple.
As always, eof gets set when an attempt is made to read
past the end of the stream.
Now. When you do
iss >> box_y;
How does op>> detect that it has read the whole number:
* When a character is read from the stream that can no
longer belong to that number (such as eg. whitespace or
a character)
* Or when there is nothing more to read.
How is the second case detected: This is the tricky part.
It cannot be detected other then: when a character read operation
fails because of eof. Thus in order to figure out that the number
in the stream has been read completely, the op>> has to drive the
string into an eof state in this case (that is: the stream contains
only the number and nothing else).
--
Karl Heinz Buchegger
kbuchegg@gascad.at