All Manuals > LispWorks Foreign Language Interface User Guide and Reference Manual > 5 Function and Macro Reference

NextPrevUpTopContentsIndex

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 allow-null => string

Arguments

pointer

A pointer to a foreign string.

external-format

An external format specification.

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 .

allow-null

A boolean. The default is false.

Values

string

A Lisp string, or nil .

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 external-format .

The external-format argument is interpreted as by with-foreign-string.

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

If allow-null is true, then if a null pointer pointer is passed, nil is returned.

See also

convert-to-foreign-string
set-locale
set-locale-encodings
with-foreign-string
Modifying a string in a C function
Mapping Nil to a Null Pointer


LispWorks Foreign Language Interface User Guide and Reference Manual - 7 Dec 2011

NextPrevUpTopContentsIndex