home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 48
/
Amiga_Dream_48.iso
/
Atari
/
c
/
sozobon-v2
/
dlibsrc.lha
/
FGETS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-10-04
|
332b
|
17 lines
#include <stdio.h>
char *fgets(data, limit, fp)
char *data;
register int limit;
register FILE *fp;
{
register char *p = data;
register int c;
while((--limit > 0) && ((c = fgetc(fp)) != EOF))
if((*p++ = c) == '\n')
break;
*p = '\0';
return((c == EOF && p == data) ? NULL : data); /* NULL == EOF */
}