From: Fabian Streitel Date: 2009-08-28T15:15:12+09:00 Subject: Re: How to delete a file in Win XP --00504502cee0f2004104722d9af8 Content-Type: text/plain; charset=ISO-8859-1 > WRONG: > f = File.open('jadzia','w+') > File.unlink('jadzia') =====> ERROR > > RIGHT: > f = File.open('jadzia','w+') > f.close > File.unlink('jadzia') =====> OK! > EVEN BETTER: open('jadzia', 'w+') { |file| # write to the file } # here ruby auto-closes the file File.unlink('jadzia') =====> OK! I like the blockform better, since it prevents me from forgetting to call close, which i do almost all the time... :-) Greetz! --00504502cee0f2004104722d9af8--