progs/C2a.c
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 09 Oct 2013 15:51:03 +0100
changeset 115 c4008b31df8e
parent 105 40c51038c9e4
child 211 e6e160c7ea33
permissions -rw-r--r--
added material

// Since gets() is insecure and produces lots 
// of warnings, thereofre I use my own input 
// function instead.
char ch;
int i;

void get_line(char *dst) {
  char buffer[8];
  i = 0;
  while ((ch = getchar()) != '\n') {
    buffer[i++] = ch; 
  }
  buffer[i] = '\0';
  strcpy(dst, buffer);
}