trouble using scanf on double arguments under Windows2000

Sonnenschein, Roland Dr. sonne@csd.de
Tue Apr 2 02:18:00 GMT 2002


scanf() does not always work the way I think it should.

Sample program:

#include <stdio.h>

int main()
{
  double dstat, ddyn;
  dstat=2.;
  scanf("%lf", &ddyn);
  printf("%lf %lf\n", dstat, ddyn);
  return 0;
}

usage:
hugo <hugo.in >hugo.out

Sample input file hugo.in:
20.1

Output file hugo.out:
2.000000 201.000000

compilation:
make hugo

gcc -v yields:
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-4/specs
gcc version 2.95.3-4 (cygwin special)


Dr. Roland Sonnenschein
Abt. BV1TEF
Brüel & Kjaer Vibro GmbH
Landwehrstraße 55
D-64293 Darmstadt
Tel.: +49(0)61 51 - 32 18 99
Fax: +49(0)61 51 - 32 18 69
Email: sonne@csd.de

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list