Re: Reading strings

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

Hayden McKay wrote:
> 
> A function to read 'c' style strings from memory.
> Does anybody know a faster way?

I've always thought this, from misc_arwen.e, would be as good as it gets:

global function peek_string(atom addr)
    atom last

    -- initialize variables
    last = addr

    -- find end of string
    while peek(last) do
        last += 1
    end while

    -- get the string
    if addr != last then
        return peek( {addr, last - addr} )
    else
        return ""
    end if

    end function


I have not tested, but theoretically it ought to gain 10%, maybe more.

Not that am I sure why you want "" for strings longer than 256 chars.

Let me know,
Pete

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

Search



Quick Links

User menu

Not signed in.

Misc Menu