Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1882 | clevermous | 1 | /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ |
2 | #include |
||
3 | #include |
||
4 | |||
5 | char * fgets(char *s, int n, FILE *f) |
||
6 | { |
||
7 | int c=0; |
||
8 | char *cs; |
||
9 | cs = s; |
||
10 | while (--n>0 && (c = __getc(f)) != EOF) |
||
11 | { |
||
12 | *cs++ = c; |
||
13 | if (c == '\n') break; |
||
14 | } |
||
15 | if (c == EOF && cs == s) return NULL; |
||
16 | *cs++ = '\0'; |
||
17 | return s; |
||
18 | } |