progs/C2a.c
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Mon, 07 Oct 2013 17:25:04 +0100
changeset 109 b71ce151aba8
parent 105 40c51038c9e4
child 115 c4008b31df8e
permissions -rw-r--r--
added new version

// Since gets() is insecure and produces lots of warnings, 
// 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);
}