[C] Function key 입력 받기
#include <stdio.h>
#include <conio.h>
typedef enum {F1=315,F2,F3} key;
//typedef struct tnode_ {
// unsigned short a;
//}tnode;
int process_key() {
int a;
a = getch();
if(a == 0) {
a = getch() + 256;
}
return a;
}
int main() {
while(1) {
//printf("%d",process_key());
switch(process_key()) {//! 2바이트 여야함
case F1 :
printf("\nf1을 눌렀다");
break;
case F2 :
printf("\nf2을 눌렀다");
break;
default :
printf("\n다른키를 눌렀다");
break;
}
}
return 0;
}