diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6855f0d4ae..99a8e847bc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,7 @@ +19991013-13:52 EDT Paul Tucker + * source/rtl/inkey.c + + borland c 4.5 fixes as reported by Felipe + 19991013-18:37 GMT+1 Antonio Linares * source/rtl/browdb.prg * Renamed function to public function DbSkipper() diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index 535f07331a..477907f6d6 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -101,6 +101,23 @@ #endif #include +/* Function for clearing the keyboard buffer on Borland C++ 4.5 */ +#if defined(__BORLANDC__) && ( defined(_Windows) || defined(_WIN32) ) && (__BORLANDC__ == 0x460) + #include + + int hb_clearKeyboardBuffer( void ) + { + + HANDLE in; + + in = GetStdHandle (STD_INPUT_HANDLE); + if (in == INVALID_HANDLE_VALUE) return 0; + + FlushConsoleInputBuffer( in ); + } +#endif + + #ifdef __WATCOMC__ #include #include @@ -298,6 +315,12 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour ch = getch(); if( !ch ) /* Is a extended key */ ch = getch() + 256; + + /* Clears the keyboard buffer */ + #if (__BORLANDC__ == 0x460) + hb_clearKeyboardBuffer(); + #endif + #else /* A key code is available in the BIOS keyboard buffer */ ch = getch(); /* Get the key code */