Robert Klemme | 16 May 09:22

Re: Create an empty file of certain size

2008/5/16 Mark Dodwell <seo <at> mkdynamic.co.uk>:
>> fd.truncate( 2 ** 20 )
>
> Thanks that's great, didn't know about that method!

If it does not work on your platform, you can speed up your solution
by writing larger chunks:

BUFFER = ("a" * 1024).freeze
File.open("tmp.txt", 'wb') { |f| 10.kilobytes.times { f.write BUFFER } }

Kind regards

robert

--

-- 
use.inject do |as, often| as.you_can - without end


Gmane