Bug 5724 – web example of BufferedFile has compile error
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-03-09T02:21:00Z
Last change time
2011-03-09T02:27:29Z
Assigned to
nobody
Creator
rinick
Comments
Comment #0 by rinick — 2011-03-09T02:21:29Z
http://www.digitalmars.com/d/2.0/phobos/std_stream.html
Stream file = new BufferedFile("sample.txt");
foreach(ulong n, string line; file) {
stdout.writefln("line %d: %s",n,line);
}
Error: function std.stream.Stream.opApply (scope int delegate(ref cha
r[]) dg) is not callable using argument types (int delegate(ref ulong __applyArg
0, ref string __applyArg1))
Error: cannot implicitly convert expression (__foreachbody1239) of ty
pe int delegate(ref ulong __applyArg0, ref string __applyArg1) to int delegate(r
ef ulong n, ref wchar[] line)
Comment #1 by rinick — 2011-03-09T02:27:29Z
I found it's already reported, 3 years ago.
Can't believe the example is still not fixed.
*** This issue has been marked as a duplicate of issue 2114 ***