September 16, 2014 [Issue 13486] New: Streams fail | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13486 Issue ID: 13486 Summary: Streams fail Product: D Version: unspecified Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nobody@puremagic.com Reporter: najamkhn@gmail.com Created attachment 1429 --> https://issues.dlang.org/attachment.cgi?id=1429&action=edit Full code with compilation instruction and expeced output description Trying to get the streams to work and skip the first line but using the stdin insists on reading the first line, is it normal? seems to me that the cursor isn't getting updated after readf reads the first input? /* Compiling it the following way: dmd streamfail.d ./streamfail < input.txt Contents of `input.txt` 9 11 2 3 4 5 6 7 8 9 10 Expected Output: [11, 2] [3, 4] [5, 6] [7, 8] [9, 10] Current Output: [] [11, 2] [3, 4] [5, 6] [7, 8] [9, 10] */ import std.stdio; import std.array; import std.conv; int main() { int num, x, y; readf("%d", &num); foreach (string line; lines(stdin)) { auto coords = to!(double[])(split(line)); writeln(coords); } return true; } -- |
Copyright © 1999-2021 by the D Language Foundation