On Sat, May 11, 2013 at 8:59 AM, Bodo Kaiser <
bodo....@enabre.com> wrote:
> Hello,
>
> I would like to read the content of a text file.
>
> To achieve this I have written following file:
>
>
https://gist.github.com/bodokaiser/55e44ecb18a9705585b6
>
> I now have two problems with my current implementation:
>
> 1. on_read is only called once.
> Because of this I have to add another close to the reading if (line 52)
Maybe I'm misunderstanding what you're saying but you call
uv_fs_read(on_read) only once, therefore on_read is called only once.
> 2. result code of on_close indicates an error.
> For some reason result in line 59 equals -1 which should indicate an error.
From the gist:
uv_fs_close(loop, &close_req, result, on_close);
`result` is the number of bytes read, not the file descriptor.