converting between strings and bytes
Unable to parse email body. Email id is 8626
Unable to parse email body. Email id is 8626
On Fri, 5 Sep 2008 11:00:56 +0100 (BST), Nick Levine <ndl@ravenbrook.com> wrote: > I'm having a bad hair Friday over here. > > All I wanted to do was to convert a string (via some random > external-format) into an array of bytes. As if I could call > > (fli:with-foreign-string (ptr elements bytes :external-format from) > string > (declare (ignore elements bytes)) > (fli:convert-from-foreign-string ptr :external-format to)) > > with some value for TO which gave me a sequence of raw bytes (or > equivalently a string whose char-codes corresponded to those bytes). > > I've gone round and round on this one and feel I'm missing something > not-very-deep. Any clues? > > Oh, and I'll need to go the other way as well. There's encode-lisp-string and decode-external-string, both in the external-format package. Or (shameless plug) use these: http://weitz.de/flexi-streams/#strings HTH, Edi.