[erlang-bugs] example of io_lib:fread/2

Sebastian Egner <>
Fri Apr 11 13:01:51 CEST 2008


Serge Aleynikov wrote:
> Sebastian Egner wrote:
>> [...]
>> This is not a bug report, but an Erlang beginner here spent a long 
>> time staring at the output:
>>
>>     1> io_lib:fread("Uptime: ~d", "Uptime: 100").
>>     {ok,"d",[]}
>>
>> [...]
>
> This is not really the io_lib:fread/2 issue.  Try this:
>
> 1> [100].
> "d"
>
> When a list is printed in the shell if it contains all integers being 
> printable characters, they are printed as a string.
>
> Serge

Of course, only that the poor guy (even knowing that $d = 100 in 
Erlang!) got confused by the unfortunate choice of 100,
trying to understand "why fread returned the format instead of the 
value"... ;-)

Sebastian.



More information about the erlang-bugs mailing list