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]

Re: trouble using scanf on double arguments under Windows2000


Hi Dr. Sonnenschein and the Cygwin newsgroup,

I have had the same problem using cygwin and gcc, I
believe I am using the latest version of gcc.  I
thought I was doing something wrong in my program, but
I took the same program into Linux, Visual C++ and
HPUX 10.20 and they ran exactly the way they are
supposed to run with the correct results.  My program
was using input from the user instead of from a file,
but my results were exactly the same as the output
from your sample program.  I finally gave up on Cygwin
and gcc and write my programs on a couple of old HP-UX
10.20 workstations with the latest gcc and have no
problems.

I like Cygwin and will continue to support it and
would like to continue playing with it and writing
programs under Cygwin.  I do not want to blame gcc or
Cygwin because I like them, but I want to know what is
causing this behavior as well and is there a
workaround.

Thank you and have a nice day!

James E. Merritt

--- "Sonnenschein, Roland Dr." <sonne@csd.de> wrote:
> 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/
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://http://taxes.yahoo.com/

--
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]