[Issue 3425] StdioException on end of stdin on Windows

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 9 20:44:09 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=3425


David Simcha <dsimcha at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|std.stdio.File does not     |StdioException on end of
                   |properly handle EOF from    |stdin on Windows
                   |stdin on Windows            |
           Severity|normal                      |major


--- Comment #1 from David Simcha <dsimcha at yahoo.com> 2011-03-09 20:41:02 PST ---
I've managed to figure out where this exception is coming from, but I don't
know how to fix it because I don't know why errno is getting set.  It's on line
2271 in stdio.d:

    if (fp._flag & _IONBF)
    {
        /* Use this for unbuffered I/O, when running
         * across buffer boundaries, or for any but the common
         * cases.
         */
      L1:
        auto app = appender(buf);
        app.clear();
        if(app.capacity == 0)
            app.reserve(128); // get at least 128 bytes available

        int c;
        while((c = FGETC(fp)) != -1) {
            app.put(cast(char) c);
            if(c == terminator) {
                buf = app.data;
                return buf.length;
            }

        }

        if (ferror(fps))
            StdioException();

Can we **PLEASE** fix this one ASAP?  It's been in Bugzilla for over a year and
a half and makes it impossible to write simple text filter programs on Windows
without ugly and/or unsafe workarounds.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list