delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/19/16:13:11

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3B06D297.9030905@ece.gatech.edu>
Date: Sat, 19 May 2001 16:07:51 -0400
From: "Charles S. Wilson" <cwilson AT ece DOT gatech DOT edu>
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; m18) Gecko/20010131 Netscape6/6.01
X-Accept-Language: en
MIME-Version: 1.0
To: Richard Stanton <stanton AT haas DOT berkeley DOT edu>
CC: Cygwin <cygwin AT sources DOT redhat DOT com>
Subject: Re: Bug reading floating point numbers in gcc 2.95.3-4
References: <LNBBKMIKMNGEJNEJICPHGEKJFBAA DOT stanton AT haas DOT berkeley DOT edu>

Sigh.

Known bug in cygwin-1.3.1.  Not a problem in gcc.  A simple archive 
search would have revealed about 27 times this question has been 
answered since 1.3.1 came out.  Try a snapshot.

--Chuck

Richard Stanton wrote:

> The fscanf function in gcc 2.95.3-4 seems to ignore the decimal point in
> floating point input fields. For example, create a file containing just the
> following two numbers, say test.prn:
> 
>    26.28       2.34
> 
> Now compile and run the following program (testread.c):
> 
> #include <math.h>
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
> 
> char fileName[] = "test.prn";
> double input1, input2;
> 
> int main(int argc, char *argv[])
> {
> 
>     FILE *fpin0;
> 
>     if (((fpin0 = fopen(fileName, "r")) != NULL) &&
>         (fscanf(fpin0, "%lf %lf", &input1, &input2) == 2)) {
>         printf("Input line = %15.7f %15.7f\n", input1, input2);
>     } else printf("Error\n");
>     return 0;
> }
> 
> and this is what happens:
> 
> c:\projects\leases>gcc -v
> Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-4/specs
> gcc version 2.95.3-4 (cygwin special)
> 
> c:\projects\leases>gcc -o testread testread.c
> 
> c:\projects\leases>testread
> Input line =    2628.0000000     234.0000000
> 
> The numbers were read as if they had no decimal points in them. This doesn't
> help with the execution of my code...
> 
> Is there something wrong with my gcc setup, did I make an error in my code,
> or is this a bug?
> 
> Thanks.
> 
> Richard Stanton
> 
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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