FidoNet Echomail Archive
aust_c_here

<<< Previous Index Next >>>

From: Frank Adam
To: Paul Edwards
Date: 1997-02-28 00:31:00
Subject: Re: Borland C bug ?!?

 G'Day Paul,
 
-=> Quoting Paul Edwards to Frank Adam <=-
 FA> But if the file is corrupt or missing \n on the last line, s will indeed
 FA> be junk or unterminated.
 PE> No, only if there is some ERROR will that happen, not if it 
 PE> reaches EOF.  So if there is an error, fgets() will return 
 PE> NULL, and that program would process junk.  BFN.  Paul.
You're right, i though a missing 0d0a would cause an error. 
Apparently not.
Then in "paranoid mode" it'd have to be..

 while(NULL != fgets(buf,80,in))
  ((p = strrchr(buf,'\n')) != NULL) ? *p = '\0' : panic();
 
  L8r Frank (fadam{at}ozemail.com.au).
  
___ Blue Wave/DOS v2.21

--- Maximus 3.00
 * Origin: ZWSBBS +61-3-98276881 28800bps Multiline (3:634/396)
SEEN-BY: 50/99 54/99 620/243 623/630 632/107 348 360 633/374 634/388 396
SEEN-BY: 635/502 544 728 639/161 251 252 300 640/820 711/413 430 934 712/311
SEEN-BY: 712/407 505 506 517 623 624 704 841 713/317 714/906 800/1
@PATH: 634/396 639/252 632/360 50/99 712/624 711/934


<<< Previous Index Next >>>