[erlang-questions] eof or not eof for zero length

Richard Carlsson <>
Fri Oct 7 11:18:43 CEST 2011


On 10/07/2011 10:56 AM, Volodymyr Kyrychenko wrote:
> Hello,  Erlangers
>
> Having this code
>
> 1>  {ok, F} = file:open("build.sh",[read,raw,binary]).
> {ok,{file_descriptor,prim_file,{#Port<0.600>,7}}}
> 2>  file:pread(F, 0, 0).
> eof
> 3>  file:pread(F, 0, 1).
> {ok,<<"#">>}
>
> makes me think that result of second line is not correct, it obviously
> should not be EOF, it should be {ok,<<>>}. What do you think?
>

I reported this to erlang-bugs back in May. No reaction from OTP, though.

http://erlang.org/pipermail/erlang-bugs/2011-May/002425.html

    /Richard



More information about the erlang-questions mailing list