progs/C2a.c
changeset 105 40c51038c9e4
child 115 c4008b31df8e
equal deleted inserted replaced
104:729b86eae005 105:40c51038c9e4
       
     1 // Since gets() is insecure and produces lots of warnings, 
       
     2 // I use my own input function instead.
       
     3 char ch;
       
     4 int i;
       
     5 
       
     6 void get_line(char *dst) {
       
     7   char buffer[8];
       
     8   i = 0;
       
     9   while ((ch = getchar()) != '\n') {
       
    10     buffer[i++] = ch; 
       
    11   }
       
    12   buffer[i] = '\0';
       
    13   strcpy(dst, buffer);
       
    14 }