My code looks like this:
char * decode_input(char ch)
{
switch(ch) {
case 'g':
return "get";
break;
case KEY_F(9):
return "quit";
break;
default:
return "unknown";
break;
}
}
Any clues?
Well, KEY_F(9) would be 273 (see curses.h) which exceeds the range of char (-128,127).
A char is a number between -128 and 127. KEY_F(9) probably is a value outside of that range.
Use:
Or even better, use a debugger and determine sizeof(KEY_F(9)) to make sure it's a byte and not a short.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With