www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2114] New: Incorrect example foreach readLine()

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2114

           Summary: Incorrect example foreach readLine()
           Product: D
           Version: 2.014
          Platform: PC
               URL: std_stream.html
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jlquinn optonline.net


InputStream.opApply docs offer the following example:

 Stream file = new BufferedFile("sample.txt");
 foreach(ulong n, string line; file) {
   stdout.writefln("line %d: %s",n,line);
 }
 file.close();

This is seductively simple and desirable but doesn't compile, since line is
invariant and readLine() returns char[].  Either docs need to be fixed to use
char[] or the method needs to return a string.


-- 
May 20 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2114


Witold Baryluk <baryluk smp.if.uj.edu.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |baryluk smp.if.uj.edu.pl



07:52:30 PST ---
For reference: this bug is related to bug2081

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 24 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2114


ZY Zhou <rinick gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rinick gmail.com



*** Issue 5724 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 09 2011