On Tue, Oct 20, 2009 at 05:08:41AM -0700, Ram Bhamidipaty wrote:
> I want to write an unsigned byte sequence to stdout. How can I do that? When I
> try this: (write-sequence seq *standard-output*) I an error that says that
> stdout is not a binary-output-stream.
This seems to work:
(let ((bytes (make-array 0 :element-type '(unsigned-byte 8) :fill-pointer 0 :adjustable t)))
(loop for c across "Hello world!" do (vector-push-extend (char-code c) bytes))
(with-open-file (*standard-output* "/dev/stdout"
:element-type '(unsigned-byte 8))
(write-sequence bytes *standard-output*)
(write-byte #x0a *standard-output*))