Truncate a file: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: alternate method) |
|||
Line 894: | Line 894: | ||
truncate($file, $to) == 0 or die "Truncation was unsuccessful"; |
truncate($file, $to) == 0 or die "Truncation was unsuccessful"; |
||
}</lang> |
}</lang> |
||
The external <code>truncate</code> routine could be replaced with the following line (in which case no need for <code>NativeCall</code>): |
|||
<lang perl6>spurt $file, slurp($file).substr($to);</lang> |
|||
=={{header|Phix}}== |
=={{header|Phix}}== |