string-to-octets

Function

Package: excl

Arguments: string &key (null-terminate t) (start 0) (end (length string)) mb-vector make-mb-vector? (external-format :default)

In releases prior to 6.0, this function was named string-to-mb. The old name is preserved for backward compatibility in release 6.0, but users should use the new name.

This function returns a lisp-usb8-vector and the number of bytes copied.

This function converts (according to the external-format argument) and copies the string data from indices specified by start to end out of the lisp string into a lisp array of type (simple-array (unsigned-byte 8) (*)). This array is returned.

If the mb-vector argument is specified, then its value will be used (and returned) as the destination lisp array. If a vector is specified with the mb-vector argument and it is not long enough, an error is signaled unless make-mb-vector? is specified as non-nil, in which case a new vector is created and returned (and mb-vector is ignored).

The copied string data (in the resulting vector) is null-terminated, ie, the byte following the last data element is 0. The number of 8-bit bytes copied including the null-terminator is returned as the second value of this function.

By default, this function will convert to the native representation assumed for foreign function strings. In Allegro CL (which, starting in release 6.0 uses 16-bit characters) and in 8-bit Allegro CL, this conversion is to EUC (ie, external-format :euc) under Unix, and to Windows MultiByte (ie, external-format :mb) under Windows. Overriding the default external-format is not supported. When :default is specified, the value of *default-external-format* is used.

See also octets-to-string.

See also iacl.htm for general information on international character set support in Allegro CL.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.