Adding key code to char function