home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
200-299
/
ff254.lzh
/
Etale
/
bfgets.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-10-19
|
443b
|
26 lines
#include "exec/types.h"
#include "stdio.h"
UBYTE * bfgets(fgs, num, fp)
UBYTE *fgs;
SHORT num;
register FILE *fp;
{
register int c;
register UBYTE *cs;
cs = fgs;
while ( (--num > 0) && ( (c = getc(fp)) != EOF ) )
{
*cs++ = (UBYTE)c;
if (c==0)
{
cs--; /* throw nulls out */
num++;
}
if (c==0x0a) break; /* linefeed */
}
if (cs==fgs)
return(NULL);
*cs = '\0';
return(fgs);
}