Next Prev Up Top Contents Index

convert-from-foreign-string

Function
Summary

Converts a foreign string to a Lisp string.

Package

fli

Signature

convert-from-foreign-string pointer &key external-format length null-terminated-p => string

Arguments

pointer

A pointer to a foreign string.

external-format

A keyword specifying the format of the foreign string.

length

The length of the string to convert.

null-terminated-p

If t , it is assumed the string terminates with a null character. The default value for null-terminated-p is t .

Values

string

A Lisp string.

Description

The function convert-from-foreign-string , given a pointer to a foreign string, converts the foreign string to a Lisp string. The pointer does not need to be of the correct type, as it will automatically be coerced to the correct type as specified by the external-format keyword.

The external-format keyword is used to specify the format of the foreign string. It defaults to a format appropriate for C string of type char* . For Unicode encoded strings, specify :unicode . If you want to receive a string from the Win32 API, known as STR in the Win32 API terminology, specify *multibyte-code-page-ef* , which is a variable holding the external format corresponding to the current Windows multi-byte code page.

Either length or null-terminated-p must be non- nil . If null-terminated-p is t and length is not specified, it is assumed that the foreign string to be converted is terminated with a null character.

See Also

convert-to-dynamic-foreign-string

with-foreign-string


LispWorks Foreign Language Interface User Guide and Reference Manual - 14 Dec 2001

Next Prev Up Top Contents Index