E
Eduardo Yáñez Parareda
Hi all, in this code I read the content of a binary file which has blocks of data
separated for 'stream' and 'endstream' literals.
In buffer variable I pretend to put that blocks of data, and I get them, but I
don't know why buffer is not an Array of Strings instead of an Array of Arrays!.
When I ask for the class of buffer[0] it says me it's an Array, but I think it
should be a String.
File.open(ARGV[0], 'rb') do |file|
buffer = file.read.scan(/stream(.*?)endstream/m)
i = 0
buffer.each do |block|
s = block[2..(block[0].length - 1)]
puts s
i = i.next
end
end
separated for 'stream' and 'endstream' literals.
In buffer variable I pretend to put that blocks of data, and I get them, but I
don't know why buffer is not an Array of Strings instead of an Array of Arrays!.
When I ask for the class of buffer[0] it says me it's an Array, but I think it
should be a String.
File.open(ARGV[0], 'rb') do |file|
buffer = file.read.scan(/stream(.*?)endstream/m)
i = 0
buffer.each do |block|
s = block[2..(block[0].length - 1)]
puts s
i = i.next
end
end