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:

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. */


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.

jimen@adtech-inc.com     Adtech, Inc.    (808) 734-3300

More information about the Cygwin mailing list