msvcrt: Fixed %Lf format handling in scanf.
This commit is contained in:
parent
8ca3e80ddd
commit
bab686e7d1
|
@ -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 )
|
||||||
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 )
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue