www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/13/14:33:01

From: Antonio Carlos Moreirao de Queiroz <acmq AT coe DOT ufrj DOT br>
Message-Id: <199606131829.PAA00693@coe.ufrj.br>
Subject: Behavior of fscanf in V2
To: djgpp AT delorie DOT com
Date: Thu, 13 Jun 1996 15:29:30 -0300 (EST)

Hi,

In djgpp V1, in Borland C, or in UNIX gnu C (Sun), I use a statement as:

while (fscanf(archive,"%s",str1)!=EOF) {...}

to read all the nonblank lines in a file. "str1" receives the first item
as a string of characters, and is used to define what are the other items
that are read by other fscanf statements.
When the end of the file is reached, fscanf returns EOF and the loop
terminates.
In djgpp V2 this is apparently not happening. fscanf reads again and again
an empty line after the last item read...
Exactly the same code works with the other compilers.
Is this some bug, or am I doing something "nonstandard"?

Thanks,

Antonio Carlos M. de Queiroz

- Raw text -


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