Next: , Previous: , Up: Strings   [Contents][Index]


lisp-string-to-foreign

lisp-string-to-foreign

Syntax

Function: lisp-string-to-foreign string buffer bufsize &key start end offset encoding ⇒ buffer

Arguments and Values

string

A Lisp string.

buffer

A foreign pointer.

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*.

Description

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

foreign-string-alloc
foreign-string-to-lisp
with-foreign-pointer-as-string