Mark Dodwell | 16 May 00:06
Picon
Favicon

Create an empty file of certain size

Hi,

I need to create an empty (or at least garbage) file of a certain size.
I'm doing it the way below, but it is rather slow -- any ideas on a
quicker way?

  File.open("tmp.txt", 'w') { |f| 10.megabytes.times { f.write "a" } }

Thanks!

~ Mark
--

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


Gmane