http://d.puremagic.com/issues/show_bug.cgi?id=3425
Max Vilimpoc <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #3 from Max Vilimpoc <[email protected]> 2011-12-28 17:09:15 PST --- (In reply to comment #2) > You can work around the issue by testing for eof on the first line in the > loop. This works with no error. > > foreach(elem; stdin.byLine()) { > if (stdin.eof()) break; > writeln(elem); > } This didn't work for me, when using the example program on the D homepage: import std.stdio; void main() { ulong lines = 0; double sumLength = 0; foreach(line; stdin.byLine()) { if (stdin.eof()) break; ++lines; sumLength += line.length; } writeln("Average line length = ", lines ? sumLength / lines : 0); } I still get: std.stdio.StdioException@std\stdio.d(2159): Bad file descriptor -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
