string-to-octets

Helmut Eller <[email protected]> Sat, 29 Oct 2011 13:18:47 +0200
Newsgroups gmane.lisp.cmucl.devel
Message-ID <[email protected]>
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

_______________________________________________
cmucl-imp mailing list
[email protected]
http://lists.zs64.net/mailman/listinfo/cmucl-imp