Package: cffi

Function lisp-string-to-foreign

Lambda List

lisp-string-to-foreign (string buffer bufsize &key start end offset encoding)

Arguments

string -- A Lisp string.
bufsize -- An integer.
start, end -- Bounding index designators of string. 0 and nil, by default.
offset -- An integer greater than or equal to 0. Defauls to 0.
encoding -- Foreign encoding. Defaults to *default-foreign-encoding*.

Return Value

A foreign pointer.

Details

The lisp-string-to-foreign function copies at most bufsize-1 octets from a Lisp string using the specified encoding into buffer+offset. The foreign string will be null-terminated.

Start specifies an offset into string and end marks the position following the last element of the foreign string.

Examples

  CFFI> (with-foreign-pointer-as-string (str 255)
          (lisp-string-to-foreign "Hello, foreign world!" str 6))
  => "Hello"  
 

See also