Re: Reading strings
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 20, 2007
- 510 views
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