November 16, 2006 [Issue 528] New: cstream.flush() returns EOF early for din. | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=528 Summary: cstream.flush() returns EOF early for din. Product: D Version: 0.174 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla@digitalmars.com ReportedBy: godaves@yahoo.com cstream.flush() returns EOF before an entire din stream is read for large files on Windows. The problem seems to be with the DMC library fread/fflush routines. This is not an issue on Linux. import std.cstream, std.conv, std.stream; void main() { int sum; char[] bufr = new char[128]; char[] line; BufferedStream bsi = new BufferedStream(din,4096); while(!bsi.eof) { line = bsi.readLine(bufr); if(line.length) sum += toInt(line); } dout.writefln(sum); } test data: http://shootout.alioth.debian.org/gp4sandbox/iofile.php?test=sumcol&lang=all&file=input (note: the test data is concatenated 8000 times and then redirected into stdin). -- |
Copyright © 1999-2021 by the D Language Foundation