[Top][All Lists]

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

Re: [Chicken-users] FFI string with embedded nulls

From: Zbigniew
Subject: Re: [Chicken-users] FFI string with embedded nulls
Date: Wed, 3 Aug 2005 13:19:51 -0500


Here are two examples.  In one I create the string on the heap and
return it as a scheme-object from the C code.  In the other I write
directly into a scheme string, using a locative as the pointer. 
Neither probably works with UTF-8.  You didn't specify how the to-len
was computed, so I assume it is a function of the from-len.  Here is
an example transcript; it assumes you saved the examples to
nullstr.scm and ran csc -s nullstr.scm.

#;1> (use nullstr)
; loading ./ ...
#;2> (foo "abc")
#;3> (foo2 "abc")
#;4> (byte-vector->string (byte-vector 66 67 0 255 68 69))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]