[cmucl-imp] string-to-octets

Helmut Eller heller at common-lisp.net
Sat Oct 29 13:18:47 CEST 2011


I'm wondering how STRING-TO-OCTETS can be used with a fixed sized byte
buffer.  For example we want to write a long string to a byte stream
using a fixed size byte buffer.  STRING-TO-OCTETS seems to return the
buffer and the number of bytes written.  E.g.

(let ((buffer (make-array 20 :element-type '(unsigned-byte 8)))
      (string (make-string 100  :initial-element #\a)))
  (stream:string-to-octets string :external-format :utf32 :buffer buffer))

Returns a new vector (non-eq to buffer) and 404.

Shouldn't one return value also indicate how many characters were
converted so that the conversion can be continued at that character
offset without allocating a fresh buffer?

Helmut



More information about the cmucl-imp mailing list