If you want the samt file back you do
array out; foreach(Stdio.stdin->line_iterator();; string line) out += process_line(line); Stdio.write_file("processed.cfg", out*"\n");
Yes, we could have lots of iterators. The one I propose should be the main line iterator though since it is the correct one.
/ Peter Bortas
Previous text:
2002-12-31 13:51: Subject: stdin->line_iterator
What's the iterator-correspondence to * then? With a /-behaviour of the line iterator
foreach(Stdio.stdin->line_iterator();; string x) write("%s\n", x);
adds an extra newline to the input. It's *not* behaving like / followed by *. That makes the correspondence between line_iterator and / pretty useless, in my opinion.
Anyway, there's no need to kill each other for this. I think the gets way is the most commonly useful variant, but we could have more than one iterator if you really think some different behaviour is also useful.
/ Niels Möller ()