[Issue 14469] file.readText on Win64 doesn't work for files > 4GB.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Apr 21 12:49:12 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14469

--- Comment #1 from Kenny Alive <artemalive at gmail.com> ---
Additionally since ReadFile (and ReadFileEx too) can read file in chunks not
larger than 4GB the file reading code should be updated to something like this:

            ulong totalNumRead = 0;
            while (totalNumRead != size)
            {
                uint chunkSize = (size - totalNumRead) & 0xffffffff;
                DWORD numRead = void;
                cenforce(ReadFile(hFile, cast(ubyte*)lpBuffer + totalNumRead,
chunkSize, &numRead, null) != 0
                        && numRead == chunkSize, name);
                totalNumRead += chunkSize;
            }

--


More information about the Digitalmars-d-bugs mailing list