<?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>Programming, computer science, Christian faith and random thoughts from a random guy</description>
	<pubDate>Fri, 30 Jul 2010 02:54:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<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 "feof()". 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 &#60; 9 ) {
   printf("%d", i);
   i = i + 1;
}

The difference is that you are iterating in a file stream:

unsigned char byte;
fread(&#38;byte, 1, 1, fp);
while ( !feof(fp) ) {
   printf("%c", byte);
   fread(&#38;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(&#8221;%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(&#8221;%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>
