progs/C2a.c
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Fri, 03 Oct 2014 15:37:05 +0100
changeset 193 a97b828bf87f
parent 115 c4008b31df8e
child 211 e6e160c7ea33
permissions -rw-r--r--
updated

// 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);
}