[Issue 528] New: cstream.flush() returns EOF early for din.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 16 05:25:41 PST 2006
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 at digitalmars.com
ReportedBy: godaves at 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).
--
More information about the Digitalmars-d-bugs
mailing list