[erlang-questions] Converting a string to integer

Richard Andrews <>
Tue Jun 2 01:40:59 CEST 2009


On Tue, Jun 2, 2009 at 9:32 AM, Greg Perry <> wrote:
> Ok I have another weird problem.  I have a file that contains a single
> line that is a large number.  The file is read using read_file with the
> second element of the tuple extracted:
>
> myfile.txt:
> 123456
>
> element(2,file:read_file("myfile.txt")).
> <<"123456"...>>
>
> Why don't this work?

This is a binary not a string (ie. list). You may need to convert it
to a list first.

--
  Rich


More information about the erlang-questions mailing list