<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>RL-ARM Filesystem problem using feof</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/22765/rl-arm-filesystem-problem-using-feof</link><description> 
Hi, 

 
I&amp;#39;am using RL ARM Flash Filesystem V3.13 on Atmel AT91SAM7S256
processor. 
In the following example Reading a File (with 3 characters) the feof
function reads everytime 4 characters. 

 
here is my test programm: 

 
void TestFsEof(void) {
#define</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: RL-ARM Filesystem problem using feof</title><link>https://community.arm.com/thread/49243?ContentTypeID=1</link><pubDate>Fri, 11 Jan 2008 04:26:18 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:60bb8afd-470d-4d83-9dd6-589221270293</guid><dc:creator>Franc  Urbanc</dc:creator><description>&lt;p&gt;&lt;p&gt;
From the manual:&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;The &lt;b&gt;feof&lt;/b&gt; function returns a nonzero value after the
first read operation that attempts to read past the end of the file.
It returns 0 if the current position is not end of file. There is no
error return.&lt;br /&gt;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Your example works correctly according to the manual, but your
code is wrong. Here is a modified code:&lt;/p&gt;

&lt;pre&gt;
        fin = fopen (FNAME, &amp;quot;r&amp;quot;);
        if (fin != NULL)
        {       int RecNr = 0;
                char Car = 0;
                u32 Result;
                while (!feof (fin)) {
                        Result = fread (&amp;amp;Car, sizeof (Car), 1, fin);
                        TRACE((&amp;quot;\n\rRecNr:%d  Car:%c&amp;quot;,  RecNr, Car ));
                        &lt;b&gt;RecNr += Result;&lt;/b&gt;
                }
                fclose (fin);
        }
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>