readline.c 252 Bytes EditWeb IDE 1 2 3 4 5 6 7 8 9 10 11 12 #include <stdio.h> char *readline(char **buf) { int charsread = 0; char c = '\n'; while (fread(&c, sizeof(char), 1, stdin) && c != '\n') { charsread++; **buf = c; (*buf) += 1; } return (*buf) - charsread; }