From: Robert Klemme Date: 2009-11-30T17:00:14+09:00 Subject: Re: Ruby byte access to disk sectors like dd does 2009/11/29 Rob Biedenharn : > > On Nov 29, 2009, at 8:00 AM, Robert Klemme wrote: >> >> Write a program that reads binary files and outputs them in a similar >> format as "hexdump -C" integrating features of "dd": The program needs to be >> able to understand a series of paired options "--start X --length Y" and >> "--start X --end Z" (X, Y, Z of course being integer numbers with obvious >> properties) which denote the regions of the stream to read.  The program >> must be capable of reading from a pipe as well!  Bonus points for accepting >> parameter "--block-size B" which determines the size of chunks read in one >> read operation.  You may also invent any number of additional options which >> control formatting of the output.  Source code must be shorter than 20 lines >> of code per additional option. ;-) >> > That sounds like quiz #171 - hexdump - from early this year. > > http://rubyquiz.strd6.com/quizzes/171 I swear I wasn't aware of that. But the idea isn't too esoteric so it comes as no surprise that several people have had it. There is at least a small difference in that I included the "dd" part which does not seem to be present in #171. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/