Nicola Tiling wrote:
> The output is like this
> 
> "\000\001\000\004\000\005\000\006\000\f"
> "\000\001\000\f"
> "\000\001\000\002\000\005\000\006\000\a\000\b\000\v\000\f\000\r"
> "\000\001"
> 
> But I want to decode this output to integer vlan id's.
> 
> 1,4,5,6,12
> 1,12
> 1,2,5,6,7,8,11,12,13
> 1
> 
> How can I do it with methodes from the snmp library?

I don't know much about the SNMP library. However:

irb(main):002:0> "\000\001\000\004\000\005\000\006\000\f".unpack("n*")
=> [1, 4, 5, 6, 12]

> Also I don't understand why "f" stands for "12" and "v" for "11" and "r" 
> for "13"

\v is an escape for "vertical tab", \f is an escape for "form feed", and 
\r is "carriage return". These are ASCII characters with codes 11, 12 
and 13 respectively.

irb(main):006:0> "\f"[0]
=> 12

[ruby 1.8, use ord for ruby 1.9]

-- 
Posted via http://www.ruby-forum.com/.