readText for large files on Windows.

Kenny via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 19 12:06:01 PDT 2015


This function works fine for large text files like 100Mb or 1Gb 
but failed when I tried to read 6Gb file. This happens on Windows 
x64.

The possible reason that it uses read(in char[], size_t) function 
and on windows it calls GetFileSize. This function returns file 
size as 32 bit value. If you need size for files larger then 4Gb 
then this function provides out parameter where you can pass 
reference to another 32 bit value. But in DMD 2.067 this function 
is called as

auto size = trustedGetFileSize(h, null);

thus we never get correct size for files larget then 4Gb.

Is it a bug?


More information about the Digitalmars-d-learn mailing list