Note: This website is archived. For up-to-date information about D projects and development, please visit

I/O on stdin and stdout

Part of StandardLibraryCategory


A very simple example of I/O on stdin and stdout.

It uses streams instead of stc.c.stdio calls.


import std.cstream : din, dout ;
import std.string  : toupper   ;

int main () {
  char[] input  ,
         output ;

  // Ask for a string
  dout.writeLine("Converts a lowercase string to uppercase.");
  dout.writeLine("Please enter a string:");
  input = din.readLine();

  // Convert to upper and print it
  output = input.toupper();

  return 0;


This example is "up-to-date" as of DMD 0.163 and may present problems with earlier or later versions.