/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <time.h>

int main()
{
   int c;
   time_t t;
   t = time(NULL);
   c = -1;
   while(c < 0)
   {
      if(kbhit())
      {
         c = getch();
      }
      else
      {
          if((time(NULL)-t) > 5)
          {
             c = 'A';
          }
          else
          {
             Sleep(100);
          }
      }
   }
   printf("You entered %c\n",(char)c);
   return 0;
}
