delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/07/15:22:27

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3C62E22B.2040902@ece.gatech.edu>
Date: Thu, 07 Feb 2002 15:23:07 -0500
From: Charles Wilson <cwilson AT ece DOT gatech DOT edu>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2
X-Accept-Language: en-us
MIME-Version: 1.0
To: Michael Wirta <michaelwirta AT satx DOT rr DOT com>
CC: cygwin AT cygwin DOT com
Subject: Re: Problem with scanf and float under Cygwin on Windows ME Operating System
References: <000e01c1b010$a0123e40$c5a1a218 AT satx DOT rr DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019