From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9371 invoked by alias); 20 Aug 2002 08:56:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 9350 invoked by uid 71); 20 Aug 2002 08:56:02 -0000 Resent-Date: 20 Aug 2002 08:56:02 -0000 Resent-Message-ID: <20020820085602.9349.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, physis@excite.com Received: (qmail 4902 invoked by uid 61); 20 Aug 2002 08:51:07 -0000 Message-Id: <20020820085107.4901.qmail@sources.redhat.com> Date: Tue, 20 Aug 2002 02:16:00 -0000 From: physis@excite.com Reply-To: physis@excite.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: other/7644: GCC bug with reading '\r' in files X-SW-Source: 2002-08/txt/msg00394.txt.bz2 List-Id: >Number: 7644 >Category: other >Synopsis: GCC bug with reading '\r' in files >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Aug 20 01:56:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: physis@excite.com >Release: unknown-1.0 >Organization: >Environment: Microsoft DOS (any version 6.22 7.x), IBM PC-DOS >Description: gcc doesn't seems to compile my source file correctly so that i have a parsing issue for a file with the separator '\r' (13 in ascii, 0x0d in hexa). my program open the file "fichier.txt" and read each char and write it to the stdout in hexa. but the char '\r' is never displayed because the program never read it (it jumps to the next char). it seems that my parsing issue is due to gcc (for any version 3.1, 2.95, 2.71), because if i compile my source file with another compiler (lccwin32 or vc++) i works correctly. the file i try to parse looks like this: "tatatititoto" where is 0x0d here is the source code: #include #include #define INVENTAIRE "fichier.txt" main() { FILE *fic; char c; int i; fic = fopen(INVENTAIRE, "r"); if (fic==NULL) { printf("Erreur d'ouverture\n"); exit(EXIT_FAILURE); } for (i=0; i<9; i++) { fread(&c, 1, 1, fic); printf("%x donc %s\n", c, ((c=='\r')?"YES":"NO") ); } // for close(fic); exit(EXIT_SUCCESS); } // fin main >How-To-Repeat: just compy and paste the source code, compile it and place the file fichier.txt in the same directory. >Fix: >Release-Note: >Audit-Trail: >Unformatted: