Reading a line from stdin

Kagamin spam at here.lot
Wed Mar 16 05:49:42 PDT 2011


Ali ǥhreli Wrote:

> The following program may be surprising to the novice:
> 
> import std.stdio;
> 
> void main()
> {
>      write("What is your name? ");
>      string name = readln();
>      writeln("Hi ", name, "!");
> }

What if the user typed leading spaces? Will the program operate as you expect?


More information about the Digitalmars-d-learn mailing list