This is the mail archive of the 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: Problem with scanf and float under Cygwin on Windows ME Operating System

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);
> }


Unsubscribe info:
Bug reporting:

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