BUG: in io:fread/3: doesn't return eof

Raimo Niskanen raimo@REDACTED
Mon Oct 13 09:23:30 CEST 2003


Erlang (BEAM) emulator version 5.3 [hipe] [threads:0]

Eshell V5.3  (abort with ^G)
1> io:fread('adhoc> ', "~d~f~f~d~f").
adhoc> 1 2.0 3.0 4 5.0
{ok,[1,2.00000,3.00000,4,5.00000]}
2>

Works fine. Please give more info about from where you read input and 
how you expect the end of file in the input to appear.

-- 
/ Raimo Niskanen, Erlang/OTP, Ericsson AB


david wallin wrote:
> Subject says it all really. With release R9C-0 io:fread/3 doesn't return 
> 'eof' but an error.
> 
> The following function worked fine with R9B-1 but now I get an '{error, 
> Error}' instead of 'eof'.
> 
> get_best_fitness(Io) ->
> 
>     case io:fread(Io, 'adhoc> ', "~d~f~f~d~f") of
> 
>     {ok, [Generation, BestFitness, AvgFitness, ValidSol, Entropy]} ->
>         {Generation, BestFitness} ;
> 
>     {error, Error} ->
>         io:format("~p.get_best_fitness: unexpected format '~p'\n", 
> [?MODULE, Error]),
>         error ;
> 
>     eof -> eof
> 
>     end.
> 
> 
> 
> cheers,
> 
> --david.
> 




More information about the erlang-questions mailing list