7 lines
128 B
Crystal
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
|
|
|