|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D - std.stream example
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.
--
Apr 28 2008
On Mon, 28 Apr 2008 15:36:18 +0200, Me Here <p9e883002 sneakemail.com> = wrote:I just tried to compile the following example ffrom the std.stream doc= Apr 28 2008
On Mon, 28 Apr 2008 13:36:18 +0000 (UTC), "Me Here" <p9e883002 sneakemail.com> wrote: Apr 28 2008
|