Processing a Binary File : Binary File « File Directory « Ruby






Processing a Binary File


open('binary', 'wb') do |f|
  (0..100).step(10) { |b| f << b.chr }
end

s = open('binary', 'rb') { |f| f.read }

 








Related examples in the same category

1.Read a binary file by byte
2.Read one byte from a binary file
3.Move file position
4.Seek by position
5.File read 500 bytes
6.Open a binary file with rb+