Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: PCDATA invalid Char value 27 in Entity, line: 40 in /srv/lkml.org/scripts/getmail.php on line 216
Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: PCDATA invalid Char value 27 in Entity, line: 65 in /srv/lkml.org/scripts/getmail.php on line 216
Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: PCDATA invalid Char value 27 in Entity, line: 73 in /srv/lkml.org/scripts/getmail.php on line 216
Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: PCDATA invalid Char value 27 in Entity, line: 73 in /srv/lkml.org/scripts/getmail.php on line 216
Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, boolean given in /srv/lkml.org/scripts/getmail.php on line 219
This message generated a parse failure. Raw output follows here. Please use 'back' to navigate.
From devnull@lkml.org Fri Jan 9 23:26:56 2009
Received: from nic.funet.fi (nic.funet.fi [128.214.248.6]) by herbie.ucs.indiana.edu (8.7.5/8.6.12) with ESMTP id BAA12523 for ; Sat, 22 Feb 1997 01:34:12 -0500 (EST)
Received: from vger.rutgers.edu ([128.6.190.2]) by nic.funet.fi with ESMTP id <73940-7574>; Sat, 22 Feb 1997 08:42:46 +0200
Received: by vger.rutgers.edu id <213018-16378>; Sat, 22 Feb 1997 01:28:38 -0500
Message-Id:
X-Mailer: XFMail 1.0 [p0] on Linux
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 8bit
Mime-Version: 1.0
Date: Sat, 22 Feb 1997 01:25:40 -0500 (EST)
Organization: Berrex Computer Solutions
From: Russell Berry
To: linux-kernel@vger.rutgers.edu
Subject: Behavior of feof()
Sender: owner-linux-kernel@vger.rutgers.edu
Precedence: bulk
I've just encountered a very odd behavior of feof(); on
linux-2.0.29. In the following program:
#include
void main(){
int r,g,b,result;
char cname[80];
FILE *rgb,*color;
rgb=fopen("rgb.txt","r+");
color=fopen("XColor.java","w+");
while(!feof(rgb)){
fscanf(rgb,"%d%d%d%s",&r,&g,&b,cname);
fprintf(color," ////////////////////\n");
fprintf(color," // The color %s\n",cname);
fprintf(color," ////////////////////\n\n");
fprintf(color," public final static Color %s = new\
Color(%d, %d, %d);\n\n",cname,r,g,b);
}
fclose(rgb);
fclose(color);
}
It will not break out of the while loop when the EOF is reached,
instead, it continues writing to the output file forever, or
until the disk fills up. :) However, the following code works
as expected:
#include
void main(){
int r,g,b,result;
char cname[80];
FILE *rgb,*color;
rgb=fopen("rgb.txt","r+");
color=fopen("XColor.java","w+");
while((result=fscanf(rgb,"%d%d%d%s",&r,&g,&b,cname))!=0){
fprintf(color," ////////////////////\n");
fprintf(color," // The color %s\n",cname);
fprintf(color," ////////////////////\n\n");
fprintf(color," public final static Color %s = new\
Color(%d, %d, %d);\n\n",cname,r,g,b);
}
fclose(rgb);
fclose(color);
}
I'm confused by this behavior, the ANSI C standard denotes that
feof() returns non-zero if and only if the end of file is
reached. Yet even if I put while((feof(rgb))==0){, it still
insists that it has not reached the EOF.
Any comments and/or input on this would be appreciated.
---russ
_______________________________
Berrex Computer Solutions
Turnkey Solutions/Consulting
Software Development
http://www.albany.net/~berrex
berrex@albany.net