reading a single character in C

There is more to this than just getchar(). The terminal driver must be put into character mode and buffering must be disabled. See this post.