[Issue 2163] New: successfully reading doesn't necessarily mean not EOF in the stream

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 22 19:15:34 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2163

           Summary: successfully reading doesn't necessarily mean not EOF in
                    the stream
           Product: D
           Version: 1.030
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: davidl at 126.com


// read from source
  size_t readBlock(void* buffer, size_t size) {
    size_t res = s.readBlock(buffer,size);
    readEOF = res == 0;
    return res;
  }
readEOF = res == 0; <-- this should perform real test on the stream to see if
real EOF reached.

other wise, stream.eof become something useless. I need to catch ReadException.
and the following coding pattern is not working with the current
implementation:
while (stream.eof)
{
  stream.read(mydchar);  // if last time exactly read all data from the stream.
it will throw ReadException
}


-- 



More information about the Digitalmars-d-bugs mailing list