Truncate a file: Difference between revisions

(2 intermediate revisions by 2 users not shown)
Line 578:
 
=={{header|Elena}}==
ELENA 46.x:
<syntaxhighlight lang="elena">import system'io;
import extensions;
Line 597:
{
if (program_arguments.Length != 3)
{ console.printLine:("Please provide the path to the file and a new length"); AbortException.raise() };
auto file := File.assign(program_arguments[1]);
Line 639:
0</syntaxhighlight>
 
=={{header|Forth}}==
<syntaxhighlight lang="forth">
: truncate-file ( fname fnamelen fsize -- )
0 2swap r/w open-file throw
dup >r resize-file throw
r> close-file throw ;
</syntaxhighlight>
=={{header|Fortran}}==
Fortran offers no access to any facilities the file system may offer for truncating a disc file via standard language features, thus in the absence of special routines or deviant compilers that do, you're stuck.
Line 699 ⟶ 706:
CALL FILEHACK("foobar.txt",12)
END</syntaxhighlight>
 
 
=={{header|FreeBASIC}}==
Line 1,569 ⟶ 1,575:
=={{header|Wren}}==
{{libheader|Wren-ioutil}}
<syntaxhighlight lang="ecmascriptwren">import "./ioutil" for FileUtil
 
var fileName = "temp.txt"
1

edit