/* 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>

void input(char *pmt,char *fmt,void *data)
{
   while(1)
   {
      printf("%s",pmt);
      if(scanf(fmt,data))
         return;
      else
         fflush(stdin);
   }
}

int main()
{
   int i;
   char s[100];
   input("Indtast tal: ", "%d", &i);
   printf("%d\n",i);
   input("Indtast tekst: ", "%s", s);
   printf("%s\n",s);
   return 0;
}
