Jump to content

Write entire file: Difference between revisions

m (Added screenshot)
imported>Fth
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.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.