this is the windows-thang for a keypress-read without enter. output char and ascii-value. loop terminated by ‘#’.
//offensichtlich ein windowsding
#include<stdio.h>//standardinout
//windows for kbhit and getchar
#include<conio.h>
//for sleep
#include<windows.h>
//linux
//#include <termios.h>
//#include <string.h>
int main() {
int countdown;
char ch;
int wert;
char b;
do {
while(countdown++ <= 1000)
{
if(b=kbhit())
break;
Sleep(1);
}
ch = getch();
wert = ch;
if (b != 0)
{ printf("key %c ascii %d\n", ch, wert);}
} while (ch != '#');
printf ("programmende\n");
return 0;
}