Re: new allocate_string functions
- Posted by Bernard Ryan <xotron at bluefrog.com> Sep 13, 2004
- 421 views
Robert Craig wrote: > > 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: > > }}} <eucode> > 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 > </eucode> {{{ > > Regards, > Rob Craig > Rapid Deployment Software > <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a> > Rob: Can't you do this ?
if mem then poke(mem, s&0) -- poke(mem+length(s), 0) -- Thanks to Aku end if
Bernie My files in archive: http://www.rapideuphoria.com/w32engin.zip http://www.rapideuphoria.com/mixedlib.zip http://www.rapideuphoria.com/eu_engin.zip http://www.rapideuphoria.com/win32eru.zip