FIX: istream::operator>>(long&) Does Not Clear errno (149966)
The information in this article applies to:
- The C Run-Time (CRT), when used with:
- Microsoft Visual C++ for Windows, 16-bit edition 1.52
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 2.2
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET (2002)
This article was previously published under Q149966 SYMPTOMS
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.
Modification Type: | Major | Last Reviewed: | 12/10/2003 |
---|
Keywords: | kbfix kbCRT KB149966 kbAudDeveloper |
---|
|