Wednesday, 5 March 2014

Re: [gccsdk] fgets problem/Unixlib

On 04/03/14 11:05, david_m_gee wrote:
> On GCC 4.1.2/Unixlib, running on a Raspberry Pi, fgets() does not appear
> to work. It returns NULL when there is data in the file to read. It
> makes no difference whether the code is statically or dynamically
> linked, but the shared C library version works fine with exactly the
> same data file.
>
> See https://www.riscosopen.org/forum/forums/11/topics/2447 for further
> details.

I tried the test binaries, both dynamic and static, with RISC OS running
in rpcemu. They both worked as expected. When you say that there is an
infinite loop, do you get:

0 :

repeated over and over? I found that this occurred when the test file
was not found. For example, from the directory holding the binary and
test file:

testdynamic errors/lst

failed with an infinite loop as above, but

testdynamic errors.lst

worked correctly.
This may explain why it works with the SharedCLibrary as it doesn't
use filename translation.

Perhaps you could alter the code to test the result of fopen to ensure
the file is in fact being found?

Thanks,
Lee.


_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
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

No comments:

Post a Comment