Truncate a file: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: Used "with" statement, and changed to be a function)
(Added PicoLisp)
Line 171: Line 171:
# Truncate a file to 567 bytes.
# Truncate a file to 567 bytes.
truncate("file", 567);</lang>
truncate("file", 567);</lang>

=={{header|PicoLisp}}==
On the 64-bit version, we can call the native runtime library:
<lang PicoLisp>(de truncate (File Len)
(native "@" "truncate" 'I File Len) )</lang>
Otherwise (on all versions), we call the external truncate command:
<lang PicoLisp>(de truncate (File Len)
(call "truncate" "-s" Len File) )</lang>


=={{header|Python}}==
=={{header|Python}}==