File input/output: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 2,487: | Line 2,487: | ||
(out "output.txt" |
(out "output.txt" |
||
(echo) ) )</lang> |
(echo) ) )</lang> |
||
=={{header|Pike}}== |
|||
===Line by line=== |
|||
<lang Pike> |
|||
object lines = Stdio.File("input.txt")->line_iterator(); |
|||
object out = Stdio.File("output.txt", "cw"); |
|||
foreach(lines; int line_number; string line) |
|||
out->write(line + "\n"); |
|||
</lang> |
|||
Note that "\r" will be passed on like any other character. If line_iterator is called with the argument 1 it will however run in trim mode, and all "\r"s will be discarded. |
|||
=={{header|PL/I}}== |
=={{header|PL/I}}== |