Mail Archives: djgpp/1997/08/01/13:27:21
I don't dare describe it as a bug, but IMHO it's at least a misfeature. The
problem is that scanf("%e",...) (or %f, or %g) reads a float. But if you use
upper case, it reads a double instead (or a long double if you use an `l'
already). As a workaround, to read a double, use the standard %le format.
Can somebody with a copy of the ANSI standard enlighten us as to whether
this is supposed to happen? There is already a bug with formats like %LG,
for which I posted a patch some time ago.
At 09:15 7/31/1997, you wrote:
>---------------
>#include <stdio.h>
>#include <conio.h>
>double d;
>
>int main(int argc,char*argv[])
> {clrscr();
> /* this doesn`t work*/
> scanf("%e",&d);
> printf("\n%E",d);
>
>/* this works */
> scanf("%E",&d);
> printf("\n%E",d);
>
> getch();
> return 0;
> }
> --------
>I couldn`t believe myself until I tried.
>I was running this in a dos box under win95. I checked under plain
>dos: the question holds (is this a known libc bug?).
>There`s even more. If I put first scanf("%g",&d); it works fine.
>The input didn`t have any exponent.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -