On 2004-02-03, at 13:00:50 -0500, Sherm Pendley wrote: > On Feb 3, 2004, at 12:33 PM, Marcus Holland-Moritz wrote: > > > On 2004-02-03, at 08:14:19 -0800, Chris Masters wrote: > > > >> How do I use the pointer within perl? I need to loop > >> through each byte and print it's value (in hex or > >> binary). > > > > No way. The pointer is useless inside a perl script. > > Pointers are perfectly usable from Perl, with a little pack()/unpack() > trickery. Assuming that the function foo() returns a void* in an IV: > > my $pointer = pack('L', foo()); > my $char_array = unpack('P12', $pointer); > my @chars = unpack('c12', $char_array);
Nice. You're absolutely right. I just haven't used P/p yet. > It's certainly not the most intuitive or readable code in the world, > but it does work. TMTOWTDI ;-) > sherm-- -- If you have a procedure with 10 parameters, you probably missed some.