Jump to content

Truncate a file: Difference between revisions

Lingo added
m (added a ;Task: (bold) header.)
(Lingo added)
Line 618:
end
</lang>
 
=={{header|Lingo}}==
With native means (Fileio Xtra) file truncation can only be implemented indirectly, either using a temp file or loading truncated file contents into memory, deleting original and writing memory back to file.
 
But there are free plugins ("Xtras") like e.g. "BinFile Xtra" that support "in-file" truncation:
{{libheader|BinFile Xtra}}
<lang lingo>-- truncates file to 10 KB length
bx_file_truncate(_movie.path&"foo.dat", 10240)</lang>
 
=={{header|Lua}}==
Lua treats strings as being invariably one byte per character (hence the awkwardness of trying to use it with unicode), so it's safe to use string methods to truncate binary data.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.