Re: [MacRuby-devel] Accessing bytes within NSData

2009-03-31 Thread Pete Yandell
On 25/03/2009, at 6:03 AM, Brian Chapados wrote: Since you have an NSData object, you should be able to convert it to a String (NSString) and then use unpack. For example: socket_port = NSSocketPort.alloc.initWithTCPPort(1) addr = socket_port.address addr_str = NSString.alloc.initWithData

Re: [MacRuby-devel] Accessing bytes within NSData

2009-03-24 Thread Brian Chapados
Hi Pete, Since you have an NSData object, you should be able to convert it to a String (NSString) and then use unpack. For example: socket_port = NSSocketPort.alloc.initWithTCPPort(1) addr = socket_port.address addr_str = NSString.alloc.initWithData(addr, encoding:NSString.defaultCStringEnco

Re: [MacRuby-devel] Accessing bytes within NSData

2009-03-24 Thread John Shea
Did I miss the answer to this one? I have a similar issue returning bytes, voids, GLfloats etc J On Mar 22, 2009, at 11:18 PM, Pete Yandell wrote: I'd like to use something like Ruby's String#unpack to pull some info out of an NSData, but I'm stumped as to how to do it. NSData.bytes returns