[Prev][Next][Index][Thread]

<c-string> and <byte-string> question



If I use as(...) to get a <c-string> from a <byte-string>, do I get a
new <c-string> with freshly allocated memory, and data copied from
the <byte-string>, or do a get a <c-string> where the address of the
<c-string> points directly to the <byte-string> data.

In the fun-dev help it mentions that a <byte-string> can be used where
a <c-string> is expected and it points to the <byte-string>
memory. I'd like to know if this is what as(<c-string>, {a
<byte-string>}) results? If so, I take it I don't call destroy(...) on
the result of as(<c-string>, {a byte-string})?

I'm calling a C function that holds on to the pointer. I was doing
as(<c-string>, ...) but I'm getting spurious crashes. If as(...)
points inside the byte-string this would probably be the reason and
I'll need to change over to explicity create a new <c-string> and copy
the data into it. Is that right?

Chris.
-- 
http://www.double.co.nz/dylan