B
Boris \BXS\ Schulz
Hi,
I have a problem with "unpack".
When I try to unpack a string, I can easily adress the individual chars
via the array.
But when I try to extract the binary values of a string, this does not
work anymore. I can neither adress individual binary digits, nor the 8
bits corresponding to a char.
Is this a feature or a bug ? And what can I do to adress the bits
individually ? Further, how do I get the binary values of an integer ?
char = "ABCDE"
myint = char.unpack("B*")
puts myint >> 0100000101000010010000110100010001000101
puts myint[3] >> nil
greetings, BXS
I have a problem with "unpack".
When I try to unpack a string, I can easily adress the individual chars
via the array.
But when I try to extract the binary values of a string, this does not
work anymore. I can neither adress individual binary digits, nor the 8
bits corresponding to a char.
Is this a feature or a bug ? And what can I do to adress the bits
individually ? Further, how do I get the binary values of an integer ?
char = "ABCDE"
myint = char.unpack("B*")
puts myint >> 0100000101000010010000110100010001000101
puts myint[3] >> nil
greetings, BXS