RubyTalk@gmail.com
11/23/2004 3:48:00 PM
10000010 65 01000010 66
the output is still wrong
I also tried adding a.binmode no luck.
Will i also have such a problem writing a binary file?
Becker
On Tue, 23 Nov 2004 21:39:42 +0900, Hugh Sasse Staff Elec Eng
<hgs@dmu.ac.uk> wrote:
>
> What about (written as if it were a patch):
>
> - a=File.open("c:\\1.txt")
> + a=File.open("c:\\1.txt", 'rb')
> a.each_byte { |byte|
> - print byte.to_s.unpack('b8'),' ',byte,' '
> + print byte.chr.unpack('b8'),' ',byte,' '
> }
>
>
> Hugh
>
>