Advertisement

How to clear the keyboard buffer?

Started by July 11, 2000 04:08 PM
5 comments, last by Ikuyubon 24 years, 5 months ago
Just as the title says, how to clear the keyboard buffer with C/ASM? please help thanx
creativity is the key:)
fflush(stdin);

----------------
- Pouya / FOO!!!
***CENSORED***
Advertisement
fflush is defined only for output streams. You''ll need to use a system-dependant function to clear an input buffer.
it works for input streams too, but i used that when i was doing dos programming. i''m pretty sure it''s won''t work for win applications

----------------
- Pouya / FOO!!!
***CENSORED***
It depends on how you're getting the keyboard buffer

I suspect that bit banging the keyboard interraupt will piss off windows.

or just get everything from the buffer & throw it away

Edited by - Magmai Kai Holmlor on July 11, 2000 11:40:51 PM
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Ditto, here is what I use...

    void InitializeInputDevices(void){	int32		i;	// Do a test call on all the key combos, to reset them	for (i=0; i<256; i++)	{		NewKeyDown(i, Graphics.hWnd);		IsKeyDown(i, Graphics.hWnd);	}}geBoolean IsKeyDown(int KeyCode, HWND hWnd){	if (GetFocus() == hWnd)		if (GetAsyncKeyState(KeyCode) & 0x8000)			return GE_TRUE;	return GE_FALSE;}//=====================================================================================//	NewKeyDown//=====================================================================================geBoolean NewKeyDown(int KeyCode, HWND hWnd){	if (GetFocus() == hWnd)		if (GetAsyncKeyState(KeyCode) & 1)			return GE_TRUE;	return GE_FALSE;}    


Ripped off from genesis...
Chris Brodie
Advertisement
quote: Original post by gimp
Ripped off from genesis...


but i thought genesis was in pure dos???

----------------
- Pouya / FOO!!!
***CENSORED***

This topic is closed to new replies.

Advertisement