Typing (except in the very simple case of the traditional American keyboard and the 7-bit ASCII standard) is an extremely complex field. I highly recommend you do this with the X client, where you can use all existing input methods.
But if you need, and you are satisfied with one keyboard and one language, you do this by interpreting events in the same way as a terminal. Check the values ββin /usr/include/linux/input.h
for the values. Tracking the position of the Shift and Ctrl keys (non-ASCII keys such as Alt, Fn, etc.) suits you to interpret, of course) and emit the corresponding byte in the key up event. You might also want to implement an auto-repeat facility if the defaults do not work for your application.
But in principle: no. This is a difficult problem (!) Than you seem to understand.
source share