Input from console
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
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.
Example:
---
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
http://www.digitalmars.com/d/phobos/std_stream.html
More information about the Digitalmars-d-learn
mailing list