[erlang-questions] Sometime it's the simple stuff...

Christian S <>
Thu May 1 18:31:14 CEST 2008


On Thu, May 1, 2008 at 3:56 PM, Dave Bryson <> wrote:
> I need to take an IP address in the form of "[{10,0,1,100}]" and
>  create an http URL like this:  "http://10.0.1.100/".  I've tried using
>  io_lib:format and successfully generated a list.  But, the inets http
>  client  doesn't  like the format and complains of a malformed URL.

Is it perhaps that you have missed that io_lib:format returns an
iolist() and not a flat string() ?

You can compose your own iolist_to_list from erlang:iolist_to_binary
with erlang:binary_to_list.  The slightly different lists:flatten
works too, for this case.

Since you didnt explain how things failed, you leave me/us having to guess.



More information about the erlang-questions mailing list