Write entire file: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
(Initial FutureBasic task solution added)
m (→‎{{header|Wren}}: Changed to Wren S/H)
(3 intermediate revisions by 2 users not shown)
Line 521:
"this is a string" "file.txt" utf8 set-file-contents</syntaxhighlight>
 
=={{header|Forth}}==
<syntaxhighlight lang="forth">
: >file ( string len filename len -- )
w/o create-file throw dup >r write-file throw r> close-file throw ;
 
s" This is a string." s" file.txt" >file
</syntaxhighlight>
=={{header|Fortran}}==
Where F is an integer with a value such as 10 (these days not being 5, standard input, nor 6, standard output), the I/O unit number. "REPLACE" means create the file if it does not exist, otherwise delete the existing file and create a new one of that name. The WRITE statement may present a single (large?) item, a list of items, and possibly there would be a series of WRITE statements if there is no need to do the deed via one WRITE only.
Line 576 ⟶ 583:
 
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
void local fn SaveFile
Line 593 ⟶ 600:
</syntaxhighlight>
{{output}}
[[File:Write entire file.png]]
 
 
=={{header|Gambas}}==
Line 1,050 ⟶ 1,057:
=={{header|Wren}}==
The easiest way to overwrite a file in Wren is to 'create' it again which truncates the existing contents.
<syntaxhighlight lang="ecmascriptwren">import "io" for File
 
// create a text file
9,486

edits