home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
zip
/
mint
/
mntlib16.lzh
/
MNTLIB16
/
FGETS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-03
|
445b
|
23 lines
/* from Dale Schumacher's dLibs */
#include <stdio.h>
#include <stddef.h>
#include <assert.h>
char *fgets(data, limit, fp)
char *data;
register int limit;
register FILE *fp;
{
register char *p = data;
register int c = EOF;
assert((data != NULL));
while((--limit > 0) && ((c = getc(fp)) != EOF))
if((*p++ = c) == '\n')
break;
*p = '\0';
return((c == EOF && p == data) ? NULL : data); /* NULL == EOF */
}