basic interactive readf from stdin

karthikeyan via Digitalmars-d-learn digitalmars-d-learn at
Sat Dec 26 12:11:27 PST 2015

On Saturday, 26 December 2015 at 19:52:15 UTC, Adam D. Ruppe 
> On Saturday, 26 December 2015 at 19:40:59 UTC, Jay Norwood 
> wrote:
>> Simple VS console app in D.
> If you are running inside visual studio, you need to be aware 
> that output will be block buffered, not line buffered, because 
> VS pipes the output making the program think it is talking to 
> another program instead of to an interactive console (well, 
> because it is!)
> Add a stdout.flush(); after writing to force it to show 
> immediately. I really think the read functions ought to flush 
> output too because this is such a FAQ. (indeed, my terminal.d 
> does flush output when you request input)

I experience the same as the OP on Linux Mint 15 with dmd2.069 
and 64 bit machine.  I have to press enter twice to get the 
output. I read and inserted 
a space before %s but still no use. Am I missing something here 
with the latest version?


import std.stdio;

int main(string[] argv)
   string nm;
   readf(" %s\n",&nm);
   // readf(" %s\n",&nm);
   // writeln("nm:",nm);
   return 0;



More information about the Digitalmars-d-learn mailing list