BUG: ios::internal Adds No Fill Characters for int and long (123161)
The information in this article applies to:
- Microsoft Visual C++ 1.5
- Microsoft Visual C++ 1.51
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Editions 4.2
This article was previously published under Q123161 SYMPTOMS
Using member function ios::flags() with flag ios::internal fails to add
fill characters after the leading sign but before the value. This only
occurs for negative integers or negative long integers. For other data
types and positive integers or positive long integers, the flag works
correctly.
The following is output from the sample program given under "MORE
INFORMATION":
--- Output Starts ---
+ 1234 // Correct, positive integer with space between
+ and 1234.
+ 1234 // Correct, positive long integer.
+ 1234.000 // Correct, positive float.
+ 1234.000 // Correct, positive double.
-1234 // Incorrect, negative integer with no space
between - and 1234.
-1234 // Incorrect, negative long integer.
- 1.23e+003 // Correct, negative float in scientific notation.
- 1.23e+003 // Correct, negative double.
--- Output Ends ---
RESOLUTION
Cast the integer or long integer values to float or double values, and use
manipulator setprecision(0) and ios flag ios::fixed. See the sample code in
the "More Information" section of this article.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbBug kbCodeGen KB123161 |
---|
|