public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: physis@excite.com To: gcc-gnats@gcc.gnu.org Subject: other/7644: GCC bug with reading '\r' in files Date: Tue, 20 Aug 2002 02:16:00 -0000 [thread overview] Message-ID: <20020820085107.4901.qmail@sources.redhat.com> (raw) >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: "tata<CR>titi<CR>toto" where <CR> is 0x0d here is the source code: #include <stdio.h> #include <stdlib.h> #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:
next reply other threads:[~2002-08-20 8:56 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-08-20 2:16 physis [this message] 2002-08-20 3:06 neil 2002-08-20 10:16 Zack Weinberg
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20020820085107.4901.qmail@sources.redhat.com \ --to=physis@excite.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).