Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

A Beginner's Guide to D/The Basics/Basic Input

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

The built-in capabilities of D (meaning the capabilities of the runtime library Phobos) for input from a console (alias terminal or DOS-Box) are very restricted. Here is a simple program that demonstrates string input with din.readLine() which reads a complete line of input. A line means all characters typed until the user pressed RETURN on keyboard. It doesn't mean a physical line in the console-window which is usually 80 characters wide. import std.cstream; /* for din.readLine() */ import std.stdio; /* for writef()/writefln() */ void main() { char[] name; writef("Hello friend. Please enter your name: "); name = din.readLine(); writefln("Thanks, %s", name); }