objarray : get_binary

objarray get_binary <obj>

Returns the binary internal representation of the objarray. Useful to avoid conversion from string or to string, or, for instance, to change from integer to chars.

e.g.

set obj [objarray new intarray -values {5 6 7 8}] 
# --> 5 6 7 8 
puts [binary encode base64 [objarray get_binary $obj]] 
# --> BQAAAAYAAAAHAAAACAAAAA== 
set obj2 [objarray new intarray -binary [objarray get_binary $obj]] 
# --> 5 6 7 8 
set obj3 [objarray new chararray -binary [objarray get_binary $obj]] 
# --> 5 0 0 0 6 0 0 0 7 0 0 0 8 0 0 0