Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int getline(char *line, int max);
- /**
- * In difference with getline-KnR:
- * this function cut '\n'
- */
- int getline(char s[], int lim)
- {
- int i, c;
- for (i = 0; i<lim-1 && (c=getchar())!= EOF && c!='\n'; i++)
- s[i] = c;
- s[i] = '\0';
- return i;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement