sprintf bug
Jimen.Ching
JChing@adtech-inc.com
Wed Jun 28 19:45:00 GMT 2000
Title: sprintf bug
Hi all,
I think there is a bug with sprintf in 1.1.2.ÃÂ The following is the
code snippet that reproduces the bug:
int
maint(int argc, char *argv[])
{
ÃÂ char buf[256];
ÃÂ double dbl = 0.0;
ÃÂ sprintf(buf, "%4.3e\n", dbl);
ÃÂ printf("%s", buf); /* buf contains garbage characters. */
ÃÂ return;
}
It seems if you have a non-zero value after the dot in the format,
then sprintf includes that many garbage characters.ÃÂ In the above case,
there are 3 garbage characters.
--jc
--
jimen@adtech-inc.comÃÂ ÃÂ ÃÂ ÃÂ Adtech, Inc.ÃÂ ÃÂ ÃÂ (808) 734-3300
More information about the Cygwin
mailing list