Erase all existing content : truncate « File Directory « Ruby






Erase all existing content

f = "log.messages"          # Filename
File.truncate(f, 0)         # Erase all existing content

 

Related examples in the same category

1.File.truncate