simple console input's not working...

Steven Schveighoffer schveiguy at yahoo.com
Mon Jun 9 09:14:24 PDT 2008


"Jarrett Billingsley" wrote
> "SodiumFree" <bob at pistachios.com> wrote in message 
> news:g2c3e2$2v9h$1 at digitalmars.com...
>> Thanks, both examples make the explanation a lot clearer. Rather strange 
>> that something like this has made it into the book though.
>
> It's probably because Tango is not complete, and has been in a constant 
> state of flux for the past year and a half since it was announced.  When 
> that chapter of the book was written, that probably was the interface to 
> Cin.readln.

I don't have a copy of the book, but I think it is just a book typo. 
According to this changeset: 
http://www.dsource.org/projects/tango/changeset/2094

readln always had the current interface since it was introduced.  What the 
book should have done was used copyln (or get):

void main(){
    Cout("What is your name? ").flush;
    auto name = Cin.copyln; // or Cin.get
    Cout("Hello ")(name).newline;
}

-Steve 




More information about the Digitalmars-d-learn mailing list