www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21657] New: MmFile cannot map empty files


          Issue ID: 21657
           Summary: MmFile cannot map empty files
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: deadalnix gmail.com

First, let's create an empty file:

$ touch me

Now let's run the following sample code:

int main(string[]) {
        import std.mmfile;
        scope f = new MmFile("me");
        return 0;

It fails with the following error:

std.exception.ErrnoException std/mmfile.d(351): Could not map file me (Invalid

Now, let's add some content to our file

$ echo love > me

Running the program again now works as expected.

Feb 22 2021