I'm trying to use the I/O Kit framework for recognize when a user press a key and when he release it. I've found this: How to tap/hook keyboard events in OSX and record which keyboard fires each event, but with this code I can only know the "scancode" and when the key is pressed, consequently I'm unable to know at which character correspond the "scancode". The unique solution I've founded is that I have to write an enormous switch statement like this
switch(scancode) {
case 4:
printf("a")
case 40:
printf(" ")
case ...:
printf(...)
but I'm sure that there's a better solution. I've tried to read Apple's guide about HID in the I/O kit but I didn't find a solution... Anyone know how to solve this problem?