This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

trouble using scanf on double arguments under Windows2000


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]