convert a tuple or list to 4 byte integer value

MEENA SELVAM <>
Fri Aug 5 21:09:40 CEST 2005


I have an IPaddress tuple {47,80,18,222} or after
conversion using tuple_to_list I have [47,80,18,222]

But the snmp object type to hold this ip address is
'IpAddress' which is 4 bytes of integer.

I tried, list_to_integer[47,80,18,222] which gives a
badarg error, 

1> list_to_integer([47,80,18,222]).
** exited:
{badarg,[{erlang,list_to_integer,[[47,80,18,222]]},
                    {erl_eval,do_apply,5},
                    {shell,exprs,6},
                    {shell,eval_loop,3}]} **

=ERROR REPORT==== 5-Aug-2005::12:02:17 ===
Error in process <0.30.0> with exit value:
{badarg,[{erlang,list_to_integer,[[47,80,18,222]]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}


But actually what I need is, not the ascii equivalent.
I need to convert this to 4 bytes one with 47, one
with 80

How can I do this?

meena

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the erlang-questions mailing list