Article ID: 149966 - Last Review: December 10, 2003 - Revision: 4.0 FIX: istream::operator>>(long&) Does Not Clear errnoThis article was previously published under Q149966 On This PageSYMPTOMS
If an error occurs when extracting long values from the stream, the
error cannot be cleared and other streams also report errors.
CAUSE
When the istream::operator>>(long& n) encounters an error, it sets
ios::failbit, but does not clear errno. This causes the stream to continue
to fail even after ios::clear is called. It also causes other streams to
fail.
RESOLUTION
To work around the bug, set errno to zero in addition to completing normal
stream error checking.
STATUS
This bug was corrected in Microsoft Visual C++ .NET 2003.
MORE INFORMATIONSample CodeAPPLIES TO
| Article Translations
|
Back to the top
