int input() { int rv; timeout (10); // 10 ms block rv = getch(); timeout (-1) // turn off timeout return rv!= ERR ? rv : 0; }