simple console input's not working...

Tower Ty towerty at msn.com.au
Fri Jun 6 03:19:00 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?


Here is another one with an output 


module test4;
import tango.io.Console;

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

Strange


More information about the Digitalmars-d-learn mailing list