Re: testing for size of pointer

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu