unknown wrote:

> mem_buf = IO.read(file_name, n, 0)
> 
> Where file_name is an argument to the script.
> 
> But after the read I observed that the size of the mem_buf is less
> than 'n' (It should be equal to 'n').

It looks like your file size is less than number of bytes you're trying 
to read.
In this case size of the mem_buf must be equal to the file size.

mem_buf.size == File.size(file_name)

Regards,
arkadi4

-- 
Posted via http://www.ruby-forum.com/.