Howdy,

This all goes on the assumption that Scheme and Chicken are OK even with
a string with embedded nulls (e.g., "foo\0bar"). That's true, right?

Now then, I have a function that looks vaguely like:

unsigned int foo(char *to, char *from, unsigned int fromlen);

which reads ``from'' and fills some result based on that into a
pre-allocated (via malloc() or, in Chicken, (allocate ...)) ``to''.
Both strings may have embedded nulls: ``fromlen'' therefore tells the
function how long ``from'' is (since strlen() won't work), and the
return value is used similarly by the caller.

So what I'm trying to do in Chicken is create a function (foo from) that
calls the C function and returns the appropriate string, already filled
out as a Scheme string (and the memory allocated for ``to'' already
freed).

I'm stumped. How do I get the string to turn into a Scheme string
without truncating it at the first embedded null?

-- TB



_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to