open/ close/ read
Michael Grunditz
michael.grunditz at gmail.com
Wed Feb 7 09:05:47 CET 2024
In message <20240207074350.GB2932 at genode-labs.com>
Christian Helmuth <christian.helmuth at genode-labs.com> wrote:
> Hello Michael,
> On Tue, Feb 06, 2024 at 13:08:22 CET, Michael Grunditz wrote:
>> Is open() read() close() supposed to work? For me they doesnt. It
>> works sometimes but not all times. It also doesnt read the file it
>> just reads the first bytes or kbytes if large file.
> Yes, those functions are supposed to work and also do in quite some
> components, most of them ported applications. Could you be a bit more
> specific about the parameters and results in failing cases?
I basicly do:
open read only
fstat to get file size
malloc a buffer with that size
read from it using that size
close the file
>> fopen fread fclose is ok and stat.
> This hints the libc implementation copes with corner cases of the
> low-level functions your code does not.
I have changed most of my code to use f* functions instead. It works just
fine so no worries.
Thanks,
Michael
More information about the users
mailing list