www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17228] New: File size() can't determine file unsearchable on

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

          Issue ID: 17228
           Summary: File size() can't determine file unsearchable on
                    Windows.
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: sprink.noreply gmail.com

The problem is that size() checks to see if the file is unsearchable by calling
tell(). But on windows ftell does not have to return a -1, so no exception is
thrown when calling tell.

https://github.com/dlang/phobos/blob/v2.073.1/std/stdio.d#L2987

https://msdn.microsoft.com/en-us/library/0ys3hc0b.aspx

"On devices incapable of seeking (such as terminals and printers), or when
stream does not refer to an open file, the return value is undefined."

--
Feb 26 2017