From 39c0cbcc70aff47e17107826aa76cb525c83b122 Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Tue, 9 Jul 2019 16:00:48 -0400 Subject: ch2 --- too_long.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 too_long.c (limited to 'too_long.c') diff --git a/too_long.c b/too_long.c deleted file mode 100644 index dcc6ed4..0000000 --- a/too_long.c +++ /dev/null @@ -1,39 +0,0 @@ -#include - -#define MAXLENGTH 1000 - -int get_line(char line[], int maxlength); -void copy(char to[], char from[]); - -/* - * MAIN - * Print all lines larger than 80 characters. - */ -main() { - int len; // current line length - char line[MAXLENGTH]; // current input line - - while ((len = get_line(line, MAXLENGTH)) > 0) - if (len > 80) { - printf("%s", line); - } - return 0; -} - -/* - * GET_LINE - * Read STDIN into LINE up to MAXLENGTH and return its length. - * Returns the length of a the line. - */ -int get_line(char line[], int maxlength) { - int c, i; - - for (i = 0; i < maxlength - 1 && (c = getchar()) != EOF && c != '\n'; ++i) - line[i] = c; - if (c == '\n') { - line[i] = c; - ++i; - } - line[i] = '\0'; - return i; -} -- cgit v1.2.3