From: Ned Konz Date: 2001-11-17T04:58:28+09:00 Subject: [ruby-talk:25641] Re: Funky file.each_byte On Friday 16 November 2001 10:48 am, Tyler wrote: > Howdy! I was filtering some files and ran into an anomaly. > I'm running Ruby 1.6.4 on an old Windows machine. Everything > was fine when I was manipulating bytes with getc/putc, but that > seemed too C-ish, so I tried a tweak to a Ruby idiom. Imagine > my surprise and delight to discover that a file with some bytes > deleted was larger than the original file! Ditto for reading. > > count = 0 > f = File.new( ARGV[0], "r") Unfortunately, you're using an "operating system" that distinguishes between "text mode" and "binary mode". use File.new( ARGV[0], "rb") instead. -- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com