Input from console

Frits van Bommel fvbommel at
Sun Feb 25 11:59:47 PST 2007

Orgoton wrote:
> This may be an awkward question, but how do we get input from the console? I mean, like scanf()? It worked for numbers, but for strings I'm haveing trouble.

import std.stdio;

import std.cstream;

void main(char[][] args)
     for (size_t i = 0; i < 5; i++) {
         char[] line = din.readLine();
         writefln("You typed: ", line);

For more Stream and InputStream methods, see

More information about the Digitalmars-d-learn mailing list