[erlang-questions] eof or not eof for zero length
Volodymyr Kyrychenko
vladimir.kirichenko@REDACTED
Fri Oct 7 11:34:53 CEST 2011
Another one:
1> {ok, B} = file:read_file("build.sh").
{ok,<<"#!/bin/sh\nrebar compile || exit -1\nmkdir -p
out\n\nMODULES=\"common leveldb yaws csv eunit io\"\n\nfor m in
$MODUL"...>>}
2> L = length(binary_to_list(B)).
193
3> {ok, F} = file:open("build.sh", [read]).
{ok,<0.35.0>}
4> file:pread(F, L+100,10).
eof
5> file:pread(F, L+100,0).
{ok,[]}
Line 5 definitely should be eof.
--
Best Regards,
Volodymyr Kyrychenko
More information about the erlang-questions
mailing list