public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* other/7644: GCC bug with reading '\r' in files
@ 2002-08-20  2:16 physis
  0 siblings, 0 replies; 3+ messages in thread
From: physis @ 2002-08-20  2:16 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: other/7644: GCC bug with reading '\r' in files
@ 2002-08-20 10:16 Zack Weinberg
  0 siblings, 0 replies; 3+ messages in thread
From: Zack Weinberg @ 2002-08-20 10:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/7644; it has been noted by GNATS.

From: Zack Weinberg <zack@codesourcery.com>
To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, physis@excite.com,
	gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: other/7644: GCC bug with reading '\r' in files
Date: Tue, 20 Aug 2002 09:42:58 -0700

 On Tue, Aug 20, 2002 at 09:27:14AM -0000, neil@gcc.gnu.org wrote:
 >     This is not a GCC issue it is a library issue.
 
 Hint: fopen(INVENTAIRE, "rb");
 
 zw


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: other/7644: GCC bug with reading '\r' in files
@ 2002-08-20  3:06 neil
  0 siblings, 0 replies; 3+ messages in thread
From: neil @ 2002-08-20  3:06 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, physis

Synopsis: GCC bug with reading '\r' in files

State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Tue Aug 20 02:27:14 2002
State-Changed-Why:
    This is not a GCC issue it is a library issue.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7644


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-20 16:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-20  2:16 other/7644: GCC bug with reading '\r' in files physis
2002-08-20  3:06 neil
2002-08-20 10:16 Zack Weinberg

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).