Re: testing for size of pointer
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Aug 20, 2005
- 522 views
On Fri, 19 Aug 2005 12:54:07 -0700, Damien <guest at RapidEuphoria.com> wrote: >how do you get the size of a pointer? or rather the size of the value the >pointer points to? > >say I am using a function from a C library that returns a pointer, the >pointer points to a string, now when I try to peek() the pointer to >get the string it only returns the first letter in that string. How do >I get the size of the string being pointed to? I'm so used to using it, I forget this is not part of standard Eu. Arwen defines peek_string (similar to Matt's reply), though win32lib defines:
global function w32peek_string(atom a) -- V0.56 Al Getz integer l sequence s -- Only deal with non-zero addresses if a then l = c_func(xlstrlen,{a}) s = l_SafePeek({a, l}) else s = {} end if -- send back all the bytes found. return s end function
which is probably much faster, though I have not tested it. Regards, Pete