In C, I might memcpy an int or short into an array of characters. Is
there some wonderful way in Ruby to append the bytes which compose a
numeric value to a character array? This is useful for things like
constructing fixed-length field packets. Thank you.
[Brian]:
In C, I might memcpy an int or short into an array of characters. Is
there some wonderful way in Ruby to append the bytes which compose a
numeric value to a character array? This is useful for things like
constructing fixed-length field packets. Thank you.
Look at the #pack and #unpack functions.
// Niklas