Mail Archives: djgpp/1997/07/16/15:40:45
I posted this before but I think it got lost in transit.
Jan Hubicka wrote:
>Hi
>I need to save/restore long doubles from file in as standard way as possible.
>Under linux I use printf("%LG"... and scanf("$LG...
>But under djgpp scanf seems to be broken.
I investigated this and it appears to be a libc bug. When a capital letter
is used, _doscan_low changes "long" sizes to "long double" size and anything
else to "long". It fails to account for the possibility that it may already
be "long double".
To work around, use scanf("%Lg..."...). Also included here is a patch which
fixes the bug. I do not, however, know whether it might break anything else.
Some input from the maintainer would be appreciated.
Patch to apply to src/libc/ansi/stdio/doscan.c
--cut--
*** olddosca.c Sat May 18 21:40:02 1996
--- doscan.c Mon Jul 14 12:01:54 1997
***************
*** 100,104 ****
if (size==LONG)
size = LONGDOUBLE;
! else
size = LONG;
}
--- 100,104 ----
if (size==LONG)
size = LONGDOUBLE;
! else if (size != LONGDOUBLE)
size = LONG;
}
--cut--
HTH
Nate Eldredge
eldredge AT ap DOT net
- Raw text -