# 2.11BSD#431 - /usr/src/share/learn/C/getline.c

##### Functions

    getline           X

       1: #include <stdio.h>
       2:
       3: getline(s, lim) /* get line into s, return length */
       4: char s[];
       5: int lim;
       6: {
       7:     int c, i;
       8:
       9:     i = 0;
      10:     while (--lim > 0 && (c=getchar()) != EOF && c != '\n')
      11:         s[i++] = c;
      12:     if (c == '\n')
      13:         s[i++] = c;
      14:     s[i] = '\0';
      15:     return(i);
      16: }

#### Defined functions

getline defined in line 3; never used

Last modified: 1983-04-26 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 855 |