Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-Id: <4.3.1.2.20020207145658.021c5218@pop.ma.ultranet.com> X-Sender: lhall AT pop DOT ma DOT ultranet DOT com X-Mailer: QUALCOMM Windows Eudora Version 4.3.1 Date: Thu, 07 Feb 2002 14:58:12 -0500 To: "Michael Wirta" , From: "Larry Hall (RFK Partners, Inc)" Subject: Re: Problem with scanf and float under Cygwin on Windows ME Operating System In-Reply-To: <000e01c1b010$a0123e40$c5a1a218@satx.rr.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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 > >int main(void) >{ >float a = 1; > >printf("number a is %f \n",a); >scanf("===>%f",a); Replace this with: scanf("===>%f",&a); >printf("new number is %f \n",a); >exit(0); >} Larry Hall lhall AT rfk DOT com RFK Partners, Inc. http://www.rfk.com 838 Washington Street (508) 893-9779 - RFK Office Holliston, MA 01746 (508) 893-9889 - FAX -- 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/