File input/output: Difference between revisions
m
→{{header|Forth}}
m (Update Lang example: Fix spelling of Lang) |
|||
Line 2,116:
w/o create-file throw r>
begin
pad
?dup while
pad swap 3 pick write-file throw
repeat
Line 2,126:
s" output.txt" s" input.txt" copy-file</syntaxhighlight>
Note the use of "2 pick" to get the input file handle and "3 pick" to get the output file handle. Local or global variables could have been used, but in this implementation simple stack manipulation was chosen. Also, only
Also, abort" can be used instead of throw if desired.
|