Re: new allocate_string functions

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

Igor Kachan wrote:
> 
> Hi, Dear EU users:
> 
> There is the allocate_string() function
> in the standard RDS machine.e library.
> 
> Try please some variations on this theme:

OK, it's not quite as readable, but you've convinced me:

global function allocate_string(sequence s)
-- create a C-style null-terminated string in memory
    atom mem

    mem = machine_func(M_ALLOC, length(s) + 1) -- Thanks to Igor
    if mem then
        poke(mem, s)
        poke(mem+length(s), 0)  -- Thanks to Aku
    end if
    return mem
end function


Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu