2 Nov 2009 10:26
Re: writing a 'unsigned-byte sequence to stdout
Johan Ur Riise <johan <at> riise-data.no>
2009-11-02 09:26:26 GMT
2009-11-02 09:26:26 GMT
On Tue, Oct 20, 2009 at 05:08:41AM -0700, Ram Bhamidipaty wrote:
> Hi,
>
> 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"
:direction :output
:if-exists :append
:element-type '(unsigned-byte 8))
(write-sequence bytes *standard-output*)
(write-byte #x0a *standard-output*))
(values))
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
RSS Feed