From: Paul Pladijs Date: 2001-03-09T20:38:00+09:00 Subject: [ruby-talk:12321] Reading a binary file / writing binary data to a file I'm having troubles while reading binary file with under Windows. Probably, I'm forgetting something while opening a file but I can't figure out what. Currently I'm using: ruby 1.6.2 (2000-11-04) [i386-mingw32] under Windows NT. The following code opens a file with binary data. Although the size of binaryfile.dat is a few hundred bytes it only reads one byte. There is no difference in using the methods getc, gets or sysread. File.open ("binaryfile.dat", "r") { |f| while ch = f.getc puts "read a character: #{ch}" end } Also writing binary data to file causes problems. Note, everything works fine while reading plain text. Please help me. Regards, Paul.