msvcrt: Fixed %Lf format handling in scanf.

This commit is contained in:
Piotr Caban 2012-11-01 15:27:01 +01:00 committed by Alexandre Julliard
parent 8ca3e80ddd
commit bab686e7d1
2 changed files with 12 additions and 1 deletions

View File

@ -379,7 +379,7 @@ _FUNCTION_ {
}
st = 1;
if (!suppress) {
if (L_prefix) _SET_NUMBER_(long double);
if (L_prefix) _SET_NUMBER_(double);
else if (l_prefix) _SET_NUMBER_(double);
else _SET_NUMBER_(float);
}

View File

@ -31,6 +31,7 @@ static void test_sscanf( void )
char c;
void *ptr;
float res1= -82.6267f, res2= 27.76f, res11, res12;
double double_res;
static const char pname[]=" St. Petersburg, Florida\n";
int hour=21,min=59,sec=20;
int number,number_so_far;
@ -99,6 +100,16 @@ static void test_sscanf( void )
ok( ret == 2, "expected 2, got %u\n", ret);
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 */
ret = sprintf(buffer," %s", pname);
ok( ret == 26, "expected 26, got %u\n", ret);