www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/12/20/08:09:00

Date: Mon, 20 Dec 93 13:07:28 +0100
From: kuku AT acds DOT physik DOT rwth-aachen DOT de (Christoph Kukulies)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: fscanf different behaviour

In investigating why f2c.exe is illbehaving under djgpp1.11 I found out
that fscanf behaves differently under 1.11. I don't know if this is
a bug in 1.11 fscanf or just a peculiarity in fscanf which depends on the
filemode or something, though not sure.

Look at the following small test example:
#include <stdio.h>
main()
{
   FILE *ip;
   int c;
   ip=fopen("test.dat","r");
   while(fscanf(ip,"%d",&c)!= EOF)
	printf("%d\n",c);
}
with test.dat containing
1
2
3
4
5
6

Under 1.10 the above program exited as expected when fscanf returned EOF.
Under 1.11 fscanf does not return EOF.

Any clues. I have not yet had time to look into the fscanf source and low
level stuff but will do so soon.

--Chris
----------------------------------------------------------------------------
Christoph P. U. Kukulies                 | BIX: chriskuku AT bix DOT com
kuku AT acds DOT physik DOT rwth-aachen DOT de          | CIS: 73007,1525
*** Error code 1

Stop.

- Raw text -


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