std.stream example

Me Here p9e883002 at sneakemail.com
Mon Apr 28 06:36:18 PDT 2008


I just tried to compile the following example ffrom the std.stream docs:

import std.stdio;
import std.stream;

int main (char[][] args) {
    
    Stream file = new BufferedFile( "myfile" );
    foreach( ulong n, string line; file ) {
        writefln( "line %d: %s", n,line );
    }
    file.close();
    return 0;
}

I'm getting:


fhash.d(31): function std.stream.Stream.opApply (int delegate(ref char[] line)) 
does not match parameter types (int delegate(ref ulong __applyArg0, ref invariant(char)[] __applyArg1))

fhash.d(31): Error: cannot implicitly convert expression (__foreachbody15) 
of type int delegate(ref ulong __applyArg0, ref invariant(char)[] __applyArg1) 
to int delegate(ref ulong n, ref wchar[] line)

Have I got my libraries screwed up? 
Or c&p the example incorrectly?
Or is the example just out of date or otherwise screwed?

Cheers, b.



-- 




More information about the Digitalmars-d mailing list