Data source: http://rosettacode.org/wiki/Truncate_a_file