<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Using feof() and fread()</title>
	<atom:link href="http://www.cesarbs.org/blog/2009/05/06/using-feof-and-fread/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cesarbs.org/blog/2009/05/06/using-feof-and-fread/</link>
	<description>random stuff</description>
	<lastBuildDate>Mon, 19 Sep 2011 02:53:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Chandana</title>
		<link>http://www.cesarbs.org/blog/2009/05/06/using-feof-and-fread/comment-page-1/#comment-191</link>
		<dc:creator>Chandana</dc:creator>
		<pubDate>Mon, 17 Jan 2011 16:35:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.cesarbs.org/blog/?p=122#comment-191</guid>
		<description>Actually your original solution is the better one. If fread fails for reasons other than eof, it will not go to an infinite loop</description>
		<content:encoded><![CDATA[<p>Actually your original solution is the better one. If fread fails for reasons other than eof, it will not go to an infinite loop</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cesarbs</title>
		<link>http://www.cesarbs.org/blog/2009/05/06/using-feof-and-fread/comment-page-1/#comment-54</link>
		<dc:creator>cesarbs</dc:creator>
		<pubDate>Thu, 07 May 2009 02:22:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.cesarbs.org/blog/?p=122#comment-54</guid>
		<description>Haha, my post seems totally pointless now. I am going to update it and give you the credit for a much better solution :)</description>
		<content:encoded><![CDATA[<p>Haha, my post seems totally pointless now. I am going to update it and give you the credit for a much better solution <img src='http://www.cesarbs.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan Garber da Silva</title>
		<link>http://www.cesarbs.org/blog/2009/05/06/using-feof-and-fread/comment-page-1/#comment-53</link>
		<dc:creator>Bryan Garber da Silva</dc:creator>
		<pubDate>Wed, 06 May 2009 19:22:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.cesarbs.org/blog/?p=122#comment-53</guid>
		<description>Yep. I already had troubles with &quot;feof()&quot;. The key thing to remember is that you must use the while as if you were looping with an integer as the iterator like:

int i = 0;
while ( i &lt; 9 ) {
   printf(&quot;%d&quot;, i);
   i = i + 1;
}

The difference is that you are iterating in a file stream:

unsigned char byte;
fread(&amp;byte, 1, 1, fp);
while ( !feof(fp) ) {
   printf(&quot;%c&quot;, byte);
   fread(&amp;byte, 1, 1, fp);
}

But, if you compare the two algorithms, you will see the same pattern.</description>
		<content:encoded><![CDATA[<p>Yep. I already had troubles with &#8220;feof()&#8221;. The key thing to remember is that you must use the while as if you were looping with an integer as the iterator like:</p>
<p>int i = 0;<br />
while ( i &lt; 9 ) {<br />
   printf(&#8220;%d&#8221;, i);<br />
   i = i + 1;<br />
}</p>
<p>The difference is that you are iterating in a file stream:</p>
<p>unsigned char byte;<br />
fread(&amp;byte, 1, 1, fp);<br />
while ( !feof(fp) ) {<br />
   printf(&#8220;%c&#8221;, byte);<br />
   fread(&amp;byte, 1, 1, fp);<br />
}</p>
<p>But, if you compare the two algorithms, you will see the same pattern.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

