Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com From: "Richard Stanton" To: "Cygwin" Subject: Bug reading floating point numbers in gcc 2.95.3-4 Date: Sat, 19 May 2001 12:56:24 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 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 #include #include #include 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