Getch() Problem: C vs D

LouisHK via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 9 09:22:41 PST 2017


On Monday, 9 January 2017 at 13:10:30 UTC, Adam D. Ruppe wrote:
> ...
> Best solution is to skip those C library functions and do it 
> yourself with the OS-level calls. Then you can turn it off and 
> actually control the buffering behavior.

That's what I was afraid of. I even tried your terminal.d, and it 
worked for those keys above, but unfortunately it's duplicating 
the values, one little example (From your source):

if(input.kbhit()){
     auto c = input.getch();
     write(c);
}

As I could see with WinDBG, the condition "input.kbhit()" is true 
for the first 2 times after I hit a key.

L.




More information about the Digitalmars-d-learn mailing list