simple console input's not working...

Tower Ty towerty at msn.com.au
Fri Jun 6 03:09:14 PDT 2008


SodiumFree Wrote:

> So i copy this code, pretty much straight from the book (page 139):
> 
> module inputTest;
> import tango.io.Console;
> 
> void main(){
>     Cout("What is your name? ").flush;
>     auto name = Cin.readln;
>     Cout("Hello ")(name).newline;
> }
> 
> 
> However when i try compiling, dmd spits out this error:
> 
> C:\d.stuff\inputTest>dmd inputTest.d
> inputTest.d(6): function tango.io.Console.Console.Input.readln (char[],bool) does not match parameter types ()
> inputTest.d(6): Error: expected 2 arguments, not 0
> inputTest.d(7): function alias tango.io.Console.Console.Output.append (char[]) does not match parameter types (bool)
> inputTest.d(7): Error: expected 0 arguments, not 1
> 
> 
> Any idea what's going on?


While we wait this at least compiles but it is meaningless

module test4;
import tango.io.Console;

void main(){
    Cout("What is your name? ").flush;
    char[] message= "What is your pleasure?";
    auto name = Cin.readln(message);
    Cout("Hello ").newline;
}




More information about the Digitalmars-d-learn mailing list