25 lines
553 B
C
25 lines
553 B
C
#include <stdio.h>
|
|
#include "shared/functions.h"
|
|
#include "shared/limits.h"
|
|
#include "shared/functions/getlines.c"
|
|
|
|
int main() {
|
|
int len;
|
|
/* current line length */
|
|
int max;
|
|
/* maximum length seen so far */
|
|
char line[MAXLINE];
|
|
/* current input line */
|
|
char longest[MAXLINE];
|
|
/* longest line saved here */
|
|
max = 0;
|
|
while ((len = getlines(line, MAXLINE)) > 0)
|
|
if (len > max) {
|
|
max = len;
|
|
copy(longest, line);
|
|
}
|
|
if (max > 0) /* there was a line */
|
|
printf("Character count: %d\n%s", max, longest);
|
|
return 0;
|
|
}
|