|
From: Krzysztof K. <sa...@op...> - 2003-06-09 09:07:46
|
Hello,
You wrote:
OB> André Macário Barros wrote:
>> Dear Users,
>>
>> What I put in X for this loop escape when I type the Esc key?
>>
>> char key_kbd;
>>
>> do
>> {
>> cout << " loop still running " << endl;
>> }while(key_kbd = cin.get()!= X);
>>
>> -->C++ code!
OB> Write a small prog, that writes out the value of each key pressed,
OB> that'll give you the code of ESC. I don't know it.
Escape key code is 27
And this is for future:
(i don't know if it works correctly under Dev-Cpp,
but it should be easy to modify it...)
Value 0-XXX means that it is an extended code
(first char 0, next byte is key code). For example keys
F1-F10 have codes from 0-59 to 0-68.
---- CUT ----
#include <conio.h>
int main ()
{
int k;
for (;;)
{
k = getch ();
if (k == 27)
break;
gotoxy (1,2);
if (k)
cprintf (" %d ", k);
else
cprintf("0-%d ",getch());
}
return 0;
}
---- CUT ----
--
Best regards,
Krzysztof
mailto:sa...@op...
http://www.saveman.w.pl
|