Truncate a file: Difference between revisions

added AutoHotkey
(added AutoHotkey)
Line 66:
end;
end Truncate_File;</lang>
 
=={{header|AutoHotkey}}==
<lang autohotkey>truncFile("S:\Portables\AutoHotkey\My Scripts\Other_Codes\motion2.ahk", 1200)
return
 
truncFile(file, length_bytes){
if !FileExist(file)
msgbox, File doesn't exists.
FileGetSize, fsize, % file, B
if (length_bytes>fsize)
msgbox, New truncated size more than current file size
f := FileOpen(file, "rw")
f.length := length_bytes
f.close()
}</lang>
 
=={{header|BASIC}}==
Anonymous user