This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Problem with scanf and float under Cygwin on Windows ME Operating System
- From: Charles Wilson <cwilson at ece dot gatech dot edu>
- To: Michael Wirta <michaelwirta at satx dot rr dot com>
- Cc: cygwin at cygwin dot com
- Date: Thu, 07 Feb 2002 15:23:07 -0500
- Subject: Re: Problem with scanf and float under Cygwin on Windows ME Operating System
- References: <000e01c1b010$a0123e40$c5a1a218@satx.rr.com>
Michael Wirta wrote:
> I have been having a problem with scanf and floating point numbers in Cygwin
> on a WindowsME machine. I have run this same program under Linux
doubt it. see below.
> and have
> had no problems with it. As soon as the float number is entered the program
> terminates abnormally. The error message says there is a "Segmentation
> Fault : Probably a corrupted stack." The program I used is below, followed
> by the core dump file produced when the program is run. Note: I have not had
> any problems with scanf using strings or integers, only floating point
> numbers. I saw others mention this problem in the Cygwin mailing list
> archive, and someone reported that this bug had been fixed. However, I have
> the latest version of Cygwin installed, with the gcc that is included with
> the installation. Anyone have any suggestions?
>
> #include <stdio.h>
>
> int main(void)
> {
> float a = 1;
>
> printf("number a is %f \n",a);
> scanf("===>%f",a);
should be 'scanf("===>%f",&a);' (note the '&a')
> printf("new number is %f \n",a);
> exit(0);
> }
--Chuck
--
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/