Commit bab686e7 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Fixed %Lf format handling in scanf.

parent 8ca3e80d
...@@ -379,7 +379,7 @@ _FUNCTION_ { ...@@ -379,7 +379,7 @@ _FUNCTION_ {
} }
st = 1; st = 1;
if (!suppress) { if (!suppress) {
if (L_prefix) _SET_NUMBER_(long double); if (L_prefix) _SET_NUMBER_(double);
else if (l_prefix) _SET_NUMBER_(double); else if (l_prefix) _SET_NUMBER_(double);
else _SET_NUMBER_(float); else _SET_NUMBER_(float);
} }
......
...@@ -31,6 +31,7 @@ static void test_sscanf( void ) ...@@ -31,6 +31,7 @@ static void test_sscanf( void )
char c; char c;
void *ptr; void *ptr;
float res1= -82.6267f, res2= 27.76f, res11, res12; float res1= -82.6267f, res2= 27.76f, res11, res12;
double double_res;
static const char pname[]=" St. Petersburg, Florida\n"; static const char pname[]=" St. Petersburg, Florida\n";
int hour=21,min=59,sec=20; int hour=21,min=59,sec=20;
int number,number_so_far; int number,number_so_far;
...@@ -99,6 +100,16 @@ static void test_sscanf( void ) ...@@ -99,6 +100,16 @@ static void test_sscanf( void )
ok( ret == 2, "expected 2, got %u\n", ret); ok( ret == 2, "expected 2, got %u\n", ret);
ok( (res11 == res1) && (res12 == res2), "Error reading floats\n"); ok( (res11 == res1) && (res12 == res2), "Error reading floats\n");
/* Check double */
ret = sprintf(buffer, "%lf", 32.715);
ok(ret == 9, "expected 9, got %u\n", ret);
ret = sscanf(buffer, "%lf", &double_res);
ok(ret == 1, "expected 1, got %u\n", ret);
ok(double_res == 32.715, "Got %lf, expected %lf\n", double_res, 32.715);
ret = sscanf(buffer, "%Lf", &double_res);
ok(ret == 1, "expected 1, got %u\n", ret);
ok(double_res == 32.715, "Got %lf, expected %lf\n", double_res, 32.715);
/* check strings */ /* check strings */
ret = sprintf(buffer," %s", pname); ret = sprintf(buffer," %s", pname);
ok( ret == 26, "expected 26, got %u\n", ret); ok( ret == 26, "expected 26, got %u\n", ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment