Problem w/extracting doubles from imbued streams on MS Windows Vista
I am wondering if a defect has been introduced in the newer versions of MSVCRT.DLL and/or MSVCP60.DLL shipped with MS Windows Vista.
The following console application was written in MSVC 6.0 SP6 and compiled using the /MD switch. The /MD switch tells the compiler to use the C/C++ run-time libraries installed on the computer.
The tests verify that extracting and inserting a double from and onto a stream works when the computer's current locale has been applied to the stream using the stream's imbue member function.
When the program is compiled using the /MD switch, the tests in the program succeed when the program is run on MS Windows XP and earlier. However, the first test fails when the program is run on MS Windows Vista.
When the program is compiled using the /ML switch, which tells the compiler to link the C/C++ libraries into the program, the tests succeed when the program is run on all platforms including MS Windows Vista.
To be clear, when the imbue member function is not called, both tests succeed when the program is run on MS Windows Vista.
The versions of MSVCRT.DLL and MSVCP60.DLL on the machine running MS Windows Vista are both 7.0.6000.16386-11/02/2006-4:30AM.
The versions of MSVCRT.DLL and MSVCP60.DLL on my MS Windows XP SP2 machine are 7.0.2600.2180-8/4/2004-2:56AM and 6.2.3104.0-8/04/2004-2:56AM, respectively.
Here's the program.
// Imbue.cpp : Defines the entry point for the console application.
// Locale setting at startup time
static std::locale kLocaleAtStartup ("");
int main(int argc, char* argv)
// Test 1: Extracting a double from a stream using the current locale
std::istrstream s ("123123.123");
double d = 0;
s.imbue (kLocaleAtStartup); // Removing this line makes it work on Vista
s >> d;
if (s.fail () || !s.eof ())
printf ("Test 1: s >> d -> Failed\n");
printf ("Test 1: s >> d -> Passed (%.3f)\n", d);
// Test 2: Inserting a double onto a stream using the current locale
double d = 123123.123;
s << d << std::ends;
if (s.fail ())
printf ("Test 2: d >> s -> Failed\n");
printf ("Test 2: d >> s -> Passed (%s)\n", s.str ());
s.rdbuf ()->freeze (0);
Has anyone heard of this problem in the C/C++ runtime libraries shipped with MS Windows Vista? Am I doing something incorrectly?
Thank you in advance for your help.
By Aditya in forum Database
Last Post: 04-29-2002, 07:39 AM
Last Post: 04-19-2002, 11:15 AM
By David Saylor in forum dotnet.announcements
Last Post: 02-05-2002, 11:06 AM
By Iain Munro in forum ASP.NET
Last Post: 01-08-2002, 01:54 PM
By netcity in forum Enterprise
Last Post: 05-14-2001, 05:10 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center