Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define MAXLEN 10000
- int getline(char line[], int limit);
- void copy(char from[], char to[]);
- int main()
- {
- int len; // длина текущей строки
- int threshold = 7; // порог > 80 символов
- char line[MAXLEN];
- while (1)
- {
- len = getline(line, MAXLEN);
- if (len > threshold)
- printf("%s", line);
- }
- return 0;
- }
- int getline(char line[], int limit)
- {
- int c, i;
- for(i = 0; i < limit && (c = getchar()) != EOF && c != '\n'; ++i)
- line[i] = c;
- if (c == '\n') {
- line[i] = c;
- ++i;
- }
- line[i] = '\0';
- return i;
- }
- void copy(char from[], char to[])
- {
- int i = 0;
- while ((to[i] = from[i]) != '\0')
- ++i;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement