Input from console

Jesse Phillips Jesse.K.Phillips+Digitalmars at gmail.com
Sun Feb 25 23:43:27 PST 2007


On Sun, 25 Feb 2007 14:43:34 -0500, 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.

Your best bet would probably be the suggested std.cstream. However, just
cause I want to I will point you to my readf function.

http://files.openomy.com/public/nascent/stdin.d
http://files.openomy.com/public/nascent/test.d

Please note that I wrote this when I really didn't know much about scanf
or any of the other functions, in fact I know little D and C.

It doesn't handle all types, but I do continually use it when I want input
in D, and it just feels more D like then those C functions.


More information about the Digitalmars-d-learn mailing list