Alwin Blok wrote:

>>
>> However, I do have a question about binary handling. I'd like to 
>> write binary data directly to a file.
>> I found that I can use myfile.write(["1001010100"].pack("B10")), but 
>> i'd like to be able to write, for example 0b1001010100 directly to a 
>> file. How do I do that, or else, are ther other useful ways to write 
>> binary data to a file?
>>

I'd be interested in an answer to this one, too, from someone who is "in 
the know."  Whenever I've needed to write binary data in the past I've 
had to pack it into a string first... shouldn't there be  a routine 
somewhere that will write a value directly without first converting it 
to a string?

Yes, I know it isn't hard to create a method that will take a value and 
convert it to a binary string representation, but I'm wondering if there 
is already a solution to this in the existing Ruby libraries.

- Jamis

-- 
Jamis Buck
jgb3 / email.byu.edu

ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'