basic interactive readf from stdin

tcak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 26 12:38:52 PST 2015


On Saturday, 26 December 2015 at 20:19:08 UTC, Adam D. Ruppe 
wrote:
> On Saturday, 26 December 2015 at 20:11:27 UTC, karthikeyan 
> wrote:
>> 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 http://ddili.org/ders/d.en/input.html and 
>> inserted a space before %s but still no use. Am I missing 
>> something here with the latest version?
>
> Oh, I'm sorry, it isn't buffering, it is readfing into a string 
> here which is weird. Maybe try readln instead of readf.

As far as I remember, in C, if I was to be putting "\n" in scanf 
after %s, that double entering was happening. I guess that's the 
same problem. Trying same code without \n in readf can fix it I 
guess.


More information about the Digitalmars-d-learn mailing list