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 a Pointer object, but trying to use [] to dereference it gives me:

ArgumentError: can't convert C/Objective-C value `0x800059800' of type `?_?' to Ruby object

I've done a lot of digging around, reading of forum posts, playing (unsuccessfully) with BridgeSupport, etc., but it hasn't got me any closer. Any hints?

The broader context is that I'm trying to extract the TCP port number from an NSSocketPort. NSSocketPort's address method returns an NSData, which should contain a sockaddr_in, out of which I should be able to pull the port.

Thanks,

Pete Yandell
http://notahat.com/
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to