www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - =?UTF-8?B?W0lzc3VlIDE4MDE3XSBOZXc6IEZpbGUuc2l6ZSgpIHVzZXMgYSAz?=

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

          Issue ID: 18017
           Summary: File.size() uses a 32-bit signed integer for size
                    internally (gives wrong results for files over ≈2.1
                    GB)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: issues.dlang.org.kq.ajsx krzaq.cc

I think the code should say it all:

void main(string[] args)
{
    import std.stdio;
    // assume C:\code\foo.raw is 2147483648 bytes big (INT_MAX+1), for example
    // dd if=/dev/zero of=/cygdrive/c/code/foo.raw bs=65536 count=32768
    auto f = File("C:\\code\\foo.raw");
    assert(f.size == 18446744071562067968u);
    // dd if=/dev/zero of=/cygdrive/c/code/foo.raw bs=65536 count=32768
}

--
Nov 28