[erlang-questions] list manipulation

Martin Dimitrov mrtndimitrov@REDACTED
Wed Sep 5 08:56:46 CEST 2012


Hello,

I have a list, representing a UTF8 string, containing more than 225000
elements. I have load it in var L:

8> lists:flatten(L).
[60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,
 46,48,34,32,101,110,99,111,100,105,110,103,61|...]
9> list_to_binary(L).
** exception error: bad argument
     in function  list_to_binary/1
        called as
list_to_binary([60,63,120,109,108,32,118,101,114,115,105,111,
                                 
110,61,34,49,46,48,34,32,101,110,99,111,100,
                                  105,110,103|...])
10> file:write_file("data.txt", L).
{error,badarg}

Why list_to_binary/1 and write_file/2 fail?

Best regards,

Martin




More information about the erlang-questions mailing list