Subject: Re: Mixing text and binary data
From: rpw3@rpw3.org (Rob Warnock)
Date: Sat, 01 Mar 2008 05:07:56 -0600
Newsgroups: comp.lang.lisp
Message-ID: <58SdnbPCqL2RpFTanZ2dnUVZ_jCdnZ2d@speakeasy.net>
<nicolas.edel@gmail.com> wrote:
+---------------
| I would like to read/write both text and binary data on sockets and
| (*stdandard-input* *standard-output*).  Are there idioms in Lisp to
| mix text and binary ?
+---------------

You've already gotten good answers from others, but just in case
you're using CMUCL, the implementation-specific way there is to
add the :CLASS 'BINARY-TEXT-STREAM and :ELEMENT-TYPE :DEFAULT
optional args to the OPEN (or WITH-OPEN-FILE). That will let
you do both text (e.g., READ-CHAR) and binary (e.g. READ-BYTE)
operations on the resulting stream.

In particular, my CMUCL "-script" hack uses it to allow "#!"
scripts of both source files and FASLs, see:

    http://rpw3.org/hacks/lisp/site-switch-script.lisp


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607