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

At 02:49 PM 2/7/2002, 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 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?

Yes.  Fix your program as indicated below.

>#include <stdio.h>
>int main(void)
>float a = 1;
>printf("number a is %f \n",a);

Replace this with:


>printf("new number is %f \n",a);

Larry Hall                    
RFK Partners, Inc.            
838 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX

Unsubscribe info:
Bug reporting:

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