From: ts Date: 2008-05-11T22:29:45+09:00 Subject: Re: Erasing text from a file Lucas L. wrote: > Is there a way to simple erase text from the file? perhaps File#truncate ---------------------------------------------------------- File#truncate file.truncate(integer) => 0 ------------------------------------------------------------------------ Truncates _file_ to at most _integer_ bytes. The file must be opened for writing. Not available on all platforms. f = File.new("out", "w") f.syswrite("1234567890") #=> 10 f.truncate(5) #=> 0 f.close() #=> nil File.size("out") #=> 5 Guy Decoux