Truncate a file: Difference between revisions

m (D entry: one blank line less)
Line 432:
# Truncate a file to 567 bytes.
truncate("file", 567);</lang>
=={{header|Perl 6}}==
{{works with|Rakudo Star|2013-02}}
<lang perl6>use NativeCall;
 
sub truncate(Str, Int --> int) is native {*}
 
sub MAIN (Str $file, Int $to) {
given $file.IO {
.e or die "$file doesn't exist";
.w or die "$file isn't writable";
.s >= $to or die "$file is not big enough to truncate";
}
truncate($file, $to) == 0 or die "Truncation was unsuccessful";
}</lang>
 
=={{header|PicoLisp}}==
Anonymous user