Dietrich Epp answered in a comment: use ncurses library.
See also this question
And you might make an X11 client graphical application; in that case use a graphical toolkit library like GTK or Qt
If you want to make a console application, use ncurses or perhaps readline
And your question, when taken literally, has no sense: the strict C standard don't know what a key or a keystroke is (the only I/O operations mentioned in the standard are related to <stdio.h>
thru FILE
). This is why most people uses additional libraries and standards (in addition of those required by ISO C), eg. Posix...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…