Getch() Problem: C vs D
LouisHK via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jan 9 11:11:48 PST 2017
On Monday, 9 January 2017 at 18:09:21 UTC, Ivan Kazmenko wrote:
> That's because special keys actually put two characters in the
> buffer, right? Otherwise, using that buffer alone, you won't
> be able to distinguish, for example, arrow keys from capital
> Latin letters with the same codes.
No, that duplicate problem occurs even on normal keys, if I press
"a" it shows "aa", and through the WinDBG, I saw the kbhit() was
always true 2x after a key is pressed.
And I think the kbhit() (Like in many other libraries) would only
return true, when a key is pressed.
I even tried to delay using sleep() after a keystroke, but it
still duplicates after I press any key.
L.
More information about the Digitalmars-d-learn
mailing list