File input/output: Difference between revisions
Content added Content deleted
(→{{header|TXR}}: Added.) |
(+Stata) |
||
Line 2,549: | Line 2,549: | ||
true |
true |
||
end handle _ => false;</lang> |
end handle _ => false;</lang> |
||
=={{header|Stata}}== |
|||
Stata has a [http://www.stata.com/help.cgi?copy copy] command. Here is a way to implement this by reading and writing line by line. |
|||
<lang stata>program copyfile |
|||
file open fin using `1', read text |
|||
file open fout using `2', write text replace |
|||
file read fin line |
|||
while !r(eof) { |
|||
file write fout `"`line'"' _newline |
|||
file read fin line |
|||
} |
|||
file close fin |
|||
file close fout |
|||
end |
|||
copyfile input.txt output.txt</lang> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |