changeset 105 | 40c51038c9e4 |
child 115 | c4008b31df8e |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/progs/C2a.c Mon Sep 30 23:57:44 2013 +0100 @@ -0,0 +1,14 @@ +// 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); +}