String-to-bytes ?

"SmallHairyTroll <[email protected]>" <[email protected]>
Newsgroups gmane.lisp.corman
Message-ID <[email protected]>
I have opened a file of :element-type 'unsigned-byte, but need to 
write a header containing several ASCII characters, including line 
feeds.

(FORMAT "~B" var-containing-string) doesn't do the conversion - it 
accepts only an interger.

I have tried reading from a stream into an array of bytes, but read-
sequence does not perform the conversion either.. i.e.

(setf header (make-array 50 :initial-element nil :element-
type '(unsigned-byte)))
(read-sequence header (make-string-input-stream "P6~%1920 1088~%
255~%"))

I have also tried writing an array of :element-type 'unsigned-byte
to a file opened without :element-type 'unsigned-byte (i.e. a text 
file), but this does not produce a binary file.

Is there a function that will convert a string to an array/vector of 
bytes ?

-Luke


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/LIgTpC/vN2EAA/xGHJAA/SyjtlB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.