RosettaCodeData/Task/Truncate-a-file/Crystal/truncate-a-file.cr
2026-04-30 12:34:36 -04:00

7 lines
128 B
Crystal

def truncate_file (filename, pos)
File.open(filename, "r+") do |f|
f.truncate pos
end
end
truncate_file "test.txt", 10