It appears there is a bug in the C fread function in unixlib.
I expected the feof call in the following code to return
a non-zero value if the Testfile is less than 4096, instead
I get zero.
#include <stdio.h>
int main()
{
char buffer[4096];
FILE *fp;
fp = fopen("Testfile", "r");
if (fp)
{
int bytes = fread(buffer, 1, 4096, fp);
printf("Bytes read %d feof %d\n", bytes, (int)feof(fp));
fclose(fp);
}
return 0;
}
I was using GCC 4.1.1 (GCCSDK release 2).
Note: In the original code I discovered this in I did check
ferror(fp) and that was not set either.
I'm assuming this is a bug as the documentation I have found
on the internet on fread states feof should be set.
Regards,
Alan
_______________________________________________
GCCSDK mailing list [email protected]
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK