Extract reading of characters from TTY to function