www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 504] New: foreach with a file failes

reply d-bugmail puremagic.com writes:
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;
}


-- 
Nov 14 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=504






The problem does no longer appear with 0.174.


-- 
Nov 14 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=504


deewiant gmail.com changed:

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





I suppose the bug report can go, then.


-- 
Nov 15 2006