how: fread/2 with "-" in the input?

Bengt Kleberg bengt.kleberg@REDACTED
Fri May 7 11:49:27 CEST 2010


Greetings,

I have the following string: "2-1". I want to read the 2 numbers, like
this (warning, this does not work);
{ok, [Year, Month], _T} = io_lib:fread( "~i-~i", "2-1" ).

I get a bad format. Presumably since "-" can be part of the control
format?

Is there a way to tell fread/2 that I want "-", not a control


bengt



More information about the erlang-questions mailing list