Thread overview
[Issue 504] New: foreach with a file failes
Nov 14, 2006
d-bugmail
Nov 15, 2006
d-bugmail
Nov 15, 2006
d-bugmail
November 14, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=504

           Summary: foreach with a file failes
           Product: D
           Version: 0.173
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: StefanLiebig@web.de


The following code (counting lines of given file) fails (Error: Access
Violation) with 0.173 but works fine with 0.172:

import std.stdio;
import std.stream;

int main(char[][] args) {

        BufferedFile inFile = new BufferedFile();
        try {
                inFile.open( args[ 1 ], FileMode.In ) ;

                // count the lines
                int max;
                foreach ( ulong n, char[] line; inFile ) {
                        max = n;
                }

                printf( "%d", max );

        } finally {
                inFile.close();
        }

    return 0;
}


-- 

November 15, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=504





------- Comment #1 from StefanLiebig@web.de  2006-11-15 00:21 -------
The problem does no longer appear with 0.174.


-- 

November 15, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=504


deewiant@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Comment #2 from deewiant@gmail.com  2006-11-15 02:39 -------
I suppose the bug report can go, then.


--