J
Joshua Ball
[Note: parts of this message were removed to make it a legal post.]
Hi,
Can someone give me a cleaner, more rubyesque (even correct) way of printing
out the first 20 bytes of a file? My solution doesn't feel right.
open(ARGV[0], 'rb') { |f|
(0..20).each do |n|
printf "%02d: ", n
f.read(1).each_byte { | b | printf "0x%02x \n", b }
end
}
Thanks.
Hi,
Can someone give me a cleaner, more rubyesque (even correct) way of printing
out the first 20 bytes of a file? My solution doesn't feel right.
open(ARGV[0], 'rb') { |f|
(0..20).each do |n|
printf "%02d: ", n
f.read(1).each_byte { | b | printf "0x%02x \n", b }
end
}
Thanks.