writef

Claus D. Volko cdvolko at gmx.net
Sun Jan 11 03:47:19 PST 2009


Hi,

I'm currently writing a D tutorial for people new to programming, and I've experienced some strange behavior:

The following program works as intended:

// The "Hello World!" program

import std.stdio;
import std.c.stdio;

void main ()
{
  int i;                                    // Variable definition
  i = 200;                                  // Assignment
  writefln ("Hello World!");                // Function call
  writefln ("The value of i is ", i, ".");  // Function call
  getch ();                                 // Function call
}

But if I replace

writefln ("The value of i is ", i, ".");

with

writef ("The value of i is ", i, ".");

the output of "The value of i is 200." happens only after the keypress. Unfortunately, I haven't been able to find any documents about writef on the Net which could have explained why it's like this, or whether it's a bug. Therefore I'm posting my question to this newsgroup: Why?



More information about the Digitalmars-d mailing list